Croft: VSCode-style TUI written in Rust

vitali871 pts0 comments

vitali87/croft: VSCode-style TUI written in Rust - Codeberg.org

This website requires JavaScript.

vitali87/croft

Watch

Star

19

Fork

You've already forked croft

Code

Issues

Pull requests

Activity

VSCode-style TUI written in Rust

315 commits

1 branch

0 tags

18 MiB

Rust

100%

main

Find a file

HTTPS

Download ZIP<br>Download TAR.GZ<br>Download BUNDLE

Open with VS Code

Open with VSCodium

Open with Intellij IDEA

vitali87

d5aac7948e

docs(readme): highlight identical local and remote behavior as a headline feature

2026-05-31 20:47:59 -04:00

assets

feat(editor): add a VS Code-style Cmd/Ctrl+P Quick Open file finder modal (and bundle the in-flight SSH empty-state OSC-1337 hero illustration that was already half-modified on disk); the finder is a new src/widgets/file_finder.rs module owning a FileFinder { query, entries: Arc>, results: Vec, selected, scroll, last_rect, last_inner_height } plus a build_file_index() that runs ignore::WalkBuilder::build_parallel with git_ignore(true), require_git(false) and hidden(true) so the index respects .gitignore (without needing a .git directory in the workspace) and a fuzzy_score(needle_lower, hay_lower, filename_start) -> Option that does greedy subsequence matching with +5 word-boundary bonuses (after / _ - . space or at filename_start), +4 filename bonuses, +5*consecutive consecutive-char bonuses, a gap penalty equal to the byte distance since the last match capped at 20, and a length normaliser that subtracts hay_lower.len()/4 so shorter rels beat longer rels on ties; results are kept in a MAX_RESULTS=40-deep Vec sorted by descending score and then by rel.len() ascending, and refresh_results pre-clones the entries Arc once on open so per-keystroke scoring is O(N) byte compares over the cached rel_lower with no allocation churn; App gains pub file_finder: Option, file_finder_index: Option>> (lazily built on first open and shared across reopens so subsequent invocations are instant), and file_finder_image_clear_requested + consume_file_finder_image_clear() arming a one-shot terminal.clear() OR-chained into the driver's existing eviction pipeline so iTerm2's cached OSC-1337 image cells (activity-bar icons, welcome wordmark, run-debug icon, no-repo hero, codeberg badge, ssh empty-state hero, editor preview) don't bleed through the modal text — every flush_* overlay path and editor_image_payload short-circuits while file_finder.is_some(); the new is_file_finder_key matcher accepts Cmd+P and Ctrl+P (case-insensitive on 'p', rejects Shift/Alt) and routes through handle_key ahead of every other shortcut so the chord is unstealable, handle_file_finder_key services Esc/Enter/Up/Down/PgUp/PgDn/Home/End/Backspace plus printable chars with no Ctrl/Super, AND now routes Cmd+V / Ctrl+V via is_clipboard_paste_key into clipboard_reader so the user can Cmd+P then immediately Cmd+V a filename without focus games; handle_paste also detects file_finder.is_some() first and appends every non-control char from the bracketed-paste payload into the finder query (stripping \n \t \r so a copied filename with a trailing newline doesn't submit garbage) — covers iTerm2's native bracketed-paste path, while the Cmd+V key handler covers terminals that emit a CSI-u Cmd+V sequence instead; iTerm2 setup gains a Cmd+P CSI-u forwarder (key 0x70-0x100000-0x23, payload ESC [ 112 ; 9 u) AND an NSUserKeyEquivalents repoint of File > Print to Cmd+Opt+P so AppKit's app-level Print menu binding stops eating the chord before iTerm2's GlobalKeyMap is consulted (the bug the user reported when Cmd+P opened the macOS Print dialog instead of the finder); the shortcuts modal gets a new Global-pane row 'Cmd/Ctrl+P Quick Open: fuzzy-search workspace files by name'; 17 new tests across widget + app + iterm2 layers cover fuzzy scoring (subsequence, filename > directory ranking, consecutive > split with gap penalty, mixed-case lowercasing), index gitignore filtering, selection clamping, Cmd+P / Ctrl+P opening and plain 'p' falling through, Esc / Enter / Down / Backspace key flows, bracketed-paste + Cmd+V clipboard paste routing into the query, control-char stripping on paste, OSC-1337 image clear arming, modal swallowing typed chars so the editor doesn't leak, and both iTerm2 plist sides (GlobalKeyMap forwarder + Print menu relocation); bumps patch to 0.1.130

2026-05-13 11:11:53 +01:00

src

feat(editor): make the Cmd+E vim toggle global so it works from any pane and with no file open

2026-05-31 20:41:43 -04:00

tests

style: format entire codebase with cargo fmt

2026-05-26 01:50:19 +01:00

.git-blame-ignore-revs

chore: ignore the bulk cargo fmt commit in git blame

2026-05-26 01:51:07 +01:00

.gitignore

chore: drop the committed cargo-cap generator script; the gitignored .cargo/config.toml still caps this machine

2026-05-26 22:22:38 +01:00

build.rs

feat(welcome): link repository recents

2026-05-04 23:33:19 +01:00

Cargo.lock

feat(editor): make the Cmd+E vim toggle global so it works from any pane...

open ctrl iterm2 style editor paste

Related Articles