feat: add multi line navigation actions#96
Open
viastolfi wants to merge 1 commit into
Open
Conversation
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.
Closes #78.
Adds a numeric count prefix to normal-mode cursor motions, vim-style:
5jmoves the cursor down 5 rows,12Gjumps to row 12,5ggdoes the same from the top. Previously every motion only moved one row at a time, with no way to jump further without repeating a key or reaching for the mouse/search.Changes
Countstate machine (src/app/count.rs), modeled directly on the existingChord: digits accumulate viapush_digitand expire after the sameLEADER_WINDOWidle timeout, so a stale prefix never leaks into an unrelated later keypress. Capped at 8 digits to stay well clear ofu32overflow.0-9) are intercepted inresolve_normal_keybefore the action match, so they never collide with existing single-key bindings.CursorDown/CursorUptreat the pending count as a repeat count;CursorTop/CursorBottom(gg/G) treat it as an absolute target line, clamped to the visible list bounds (no out-of-bounds cursor, no panic on an empty list)." 12…"indicator while a count is pending, mirroring the existing chord indicator (" g…"); count is shown first since it's typed first (e.g.5gg).Countcovering accumulation, the 8-digit cap, and window expiry, following the same style aschord.rs's test suite.Test plan
cargo fmt --checkcargo clippy --all-targetscargo testAll pass.
Notes
HalfPageDown/HalfPageUp(Ctrl-d/Ctrl-u) intentionally don't consume a count yet — happy to wire that up too if useful, kept this PR scoped to the motions named in [feature request] Navigate by line number #78.