Skip to content

feat(picker): modernize buffer navigation - #302

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/modern-buffer-picker
Aug 21, 2026
Merged

fcoury-oai merged 1 commit into
mainfrom
fcoury/modern-buffer-picker

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Why

The buffer picker lagged behind Red's other navigation surfaces: it showed raw paths with generic icons, ignored unsaved/current-buffer state, preserved list order instead of visit history, and offered neither previews nor split navigation. Simply shortening paths would also have broken directory-based fuzzy matching.

What changed

  • Rebuild plugins/buffer_picker.hk around filename-first rows, muted parent directories, file-type icons, current/modified indicators, modified counts, and previous-buffer preselection.
  • Extend the read-only editor snapshot with stable buffer identity, workspace-relative paths, active/alternate state, MRU ordering, and UTF-8 cursor coordinates.
  • Teach shared callback pickers to fuzzy-match and highlight complete workspace-relative paths while keeping filenames prominent, and preview structurally shared live buffer contents instead of stale disk contents.
  • Add Alt-p preview toggling plus Ctrl-s/Ctrl-v split actions that restore the saved cursor; keep unnamed buffers in the picker and explain why they cannot open in a split.
  • Add focused regressions for visit ordering, duplicate filenames in different directories, unsaved previews, preview toggling, Unicode cursor conversion, split navigation, and unnamed-buffer safety.

How to Test

  1. Open several files, including two files with the same basename in different directories; edit one without saving and switch among them to establish a recent-buffer order.

  2. Press Ctrl-j or Space b. Verify filenames lead each row, directories and file icons distinguish duplicates, the current/modified markers are accurate, and the previous buffer is initially selected.

  3. Search by both filename and parent directory. Verify matching and highlighting work across the complete workspace-relative path.

  4. Select the modified buffer and toggle Alt-p off and on. Verify the preview shows the unsaved in-memory contents rather than the on-disk version.

  5. Move the cursor after a Unicode character, reopen the picker, and use Ctrl-s or Ctrl-v. Verify the requested split opens at the same line and character.

  6. Select [No Name] and attempt a split. Verify Red explains that the buffer must be saved and leaves the picker open.

  7. Run targeted coverage:

    cargo test --lib buffer_picker
    cargo test --lib dynamic_file_rows_search_and_highlight_their_workspace_relative_parent
    cargo test --test self_check

Validated locally: 2,116 library tests passed (2 ignored), both bundled-plugin self-check tests passed, and cargo clippy --all-targets --all-features -- -D warnings completed cleanly.

@fcoury
fcoury force-pushed the fcoury/modern-buffer-picker branch from 38f07fb to 74ad804 Compare August 21, 2026 22:11
@fcoury-oai
fcoury-oai merged commit 85d225e into main Aug 21, 2026
12 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/modern-buffer-picker branch August 21, 2026 22:19
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.

1 participant