Skip to content

feat(editor): add word, page, and line navigation - #183

Merged
owainlewis merged 1 commit into
mainfrom
codex/issue-168-navigation
Sep 8, 2026
Merged

feat(editor): add word, page, and line navigation#183
owainlewis merged 1 commit into
mainfrom
codex/issue-168-navigation

Conversation

@owainlewis

Copy link
Copy Markdown
Owner

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.

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds Unicode-aware word navigation and word kills, buffer endpoint movement, overlapping page movement, and validated one-based line navigation.

  • Retains grapheme traversal context across Rope chunks to avoid repeated Unicode context scans.
  • Adds command-registry entries and terminal key mappings for the new operations.
  • Stores rendered viewport height in View for page-sized movement while preserving preferred columns.
  • Adds focused tests and user-facing documentation, with one incorrect roadmap status update.

Confidence Score: 4/5

The 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

Important Files Changed

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]
Loading

Reviews (1): Last reviewed commit: "feat(editor): add word page and line nav..." | Re-trigger Greptile

Comment thread docs/roadmap.md
@owainlewis
owainlewis merged commit eb69a9a into main Sep 8, 2026
2 checks passed
@owainlewis
owainlewis deleted the codex/issue-168-navigation branch September 8, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add word, page, and line navigation for source editing

1 participant