Repository navigation
New rendering engine - #76
Merged
Merged
Conversation
resolve_lnk silenced panics with an empty hook and then reset it to the default, which dropped the human-panic hook for the rest of the session. It now saves the previous hook and puts it back.
Every keypress and every folder change used to erase the whole prompt and draw it again, and switching folders left a blank frame in between. Over SSH that showed up as flicker and as frames that arrived line by line. The prompt now keeps a retained frame (Screen) and diffs each new frame against it: - only changed rows are rewritten, each overwritten in place before the rest of the row is erased, so no row is ever blank on screen - each frame is one write wrapped in a synchronized update (DEC 2026), so supporting terminals paint it atomically and SSH sends one packet - cursor movement is relative, so there is no cursor position round trip - lines are cut to the terminal width, so nothing wraps - one Ui lives for the whole session, so a new folder is drawn over the old one, and raw mode stays on instead of toggling every frame - a resize repaints the region in place and never clears the scrollback Key handling moved into a Selector with no drawing code. It caches the fuzzy matches and recomputes them only when the search term changes. At 30 rows an arrow key now writes about 175 bytes instead of 2.2 KB.
The prompt now turns on mouse reporting while it is open. A click selects the row under the pointer, a second click on the same row within half a second chooses it like Enter: a folder opens, a file runs, or its path is printed with -x. The wheel moves the selection like the arrows. This also fixes clicks that jumped to the drive view. Without mouse reporting some terminals (VS Code, Windows Terminal) turn a click on the main screen into arrow keys that move the shell's cursor there, and each Left went up one folder. Only presses and releases are reported (modes 1000 and 1006), so moving the mouse sends nothing over SSH. The inline region only knows where it is relative to the cursor, so the first click asks the terminal for the cursor position (one round trip over SSH) and the screen tracks its rows from there. Starting the prompt still waits for nothing.
Most of the code lived in src/structs, whatever its job, plus a catch-all utils.rs. The modules now follow what the code does: - entry: the listed files and folders, their types and icons, and .lnk shortcut resolution - prompt: the interactive chooser (Ui, Selector, Theme) and the terminal it talks to, now in its own terminal.rs - render: escape sequence handling and the screen differ - system: OS helpers (pretty paths, computer name, Windows drives) Errors are printed by main only: resolving a shortcut returns None when it cannot be read, and the prompt's choose is called from main. No behaviour changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the prompt renderer with a small retained-frame renderer that only redraws rows that changed. This removes the flicker on every keypress and folder change, and fixes the slow, line-by-line ("typewriter") drawing over SSH.
Also adds mouse support: click to select, double click to open.
Why
The old renderer erased the whole prompt and drew it again on every keypress, and left a blank frame between folders. Each erase, move and line went out as a separate write, so over SSH a frame arrived in many small packets.
What changed
Rendering (
screen.rs)Prompt (
prompt/mod.rs,prompt/selector.rs)Uilives for the whole session, so each new folder is drawn over the previous oneSelector, which has no drawing code and is unit testedMouse
-xFixes
resolve_lnkno longer drops the panic hook after reading a shortcutNumbers
Measured in a 100x30 pty with 60 files, counting writes to stderr:
Dependencies
unicode-width(was already in the tree through other crates)libcon Unix only (was already in the tree), for the cursor position queryvt100as a dev dependency: a terminal emulator the tests draw intoTesting
Uiis droppedcargo fmt --checkand clippy with the CI lint set, on Windows and Linux