feat(editor): add word, page, and line navigation - #183
Merged
Conversation
Greptile SummaryThis PR adds Unicode-aware word navigation and word kills, buffer endpoint movement, overlapping page movement, and validated one-based line navigation.
Confidence Score: 4/5The implementation appears sound, but the explicit repository requirement to keep the roadmap aligned must be satisfied before merging. The functional changes have coherent dispatch paths and focused coverage; the only accepted issue is an inaccurate roadmap update that closes the wrong issue. Files Needing Attention: docs/roadmap.md
|
| Filename | Overview |
|---|---|
| src/text.rs | Adds a retained Rope grapheme cursor and Unicode word-boundary traversal with cross-chunk correctness and work-bound tests. |
| src/view.rs | Adds word, buffer-endpoint, and page movement using cached viewport height and preferred display columns. |
| src/app.rs | Integrates word kills with the kill ring and implements validated, clamped goto-line behavior. |
| src/commands.rs | Adds the new command variants and routes navigation commands through core dispatch. |
| src/input.rs | Normalizes Meta-Backspace and page-key terminal events. |
| src/keymap.rs | Binds the documented Emacs-style word, endpoint, page, and word-kill keys. |
| src/command_registry.rs | Exposes the new operations through named-command lookup and argument metadata. |
| docs/roadmap.md | Incorrectly closes issue #167 while leaving the implemented issue #168 open. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
I[Terminal key or M-x] --> K[Input normalization and keymap]
K --> C[Command dispatch]
C --> V[View navigation]
C --> A[App editing commands]
V --> B[Buffer location queries]
A --> B
B --> T[Rope and Unicode grapheme traversal]
A --> R[Kill ring and undo history]
V --> E[Visibility enforcement and rendering]
Reviews (1): Last reviewed commit: "feat(editor): add word page and line nav..." | Re-trigger Greptile
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.
Word, page, buffer-endpoint, and line commands now reach source locations directly from keys or M-x.
M-f/M-b move over Unicode words, M-d/M-Backspace cut through the kill ring, M- reach buffer endpoints, C-v/PageDown and M-v/PageUp move with two lines of overlap, and goto-line validates a positive line number and clamps beyond EOF.
Word movement retains grapheme context across rope chunks in both directions.
Review found that restarting Unicode context froze one word command for over six seconds on 16,000 flag emoji; the retained cursor reduces the same optimized probe to 3.24 ms forward and 7.77 ms backward.
The fix includes deterministic context-work bounds and comparisons with flat Unicode segmentation.
Paging stores the last rendered viewport height in View and preserves the preferred display column.
Verification: 398 unit tests pass (four existing performance diagnostics ignored), formatting, strict Clippy across all targets, and release build pass.
The release PTY session passed Unicode movement, word cuts/yank/undo, buffer endpoints, both page key forms, goto-line validation/EOF, save, and shell restoration.
Eleven of thirteen terminal integration tests pass locally; the two redirected-input tests encounter the same sandbox restrictions documented in prior PRs and remain unchanged for macOS CI.
Closes #168.