Skip to content

Comments

feat(tui): add vim hjkl navigation and mouse scroll support#36

Merged
SaladDay merged 1 commit intoSaladDay:mainfrom
lichengzhe:feat/vim-keys-and-scroll
Feb 22, 2026
Merged

feat(tui): add vim hjkl navigation and mouse scroll support#36
SaladDay merged 1 commit intoSaladDay:mainfrom
lichengzhe:feat/vim-keys-and-scroll

Conversation

@lichengzhe
Copy link
Contributor

Closes #35

Changes

Vim hjkl navigation (app.rs, +9 lines)

  • Remap h/j/k/l/// at the top of on_key, after filter/editor/form/overlay early returns
  • One remap covers all 60+ arrow key branches automatically
  • Text input modes (filter, editor, form, overlay) are unaffected — hjkl type normally there

Mouse scroll (mod.rs, +33 lines)

  • Handle ScrollUp/ScrollDown in the event loop by synthesizing arrow key events
  • Reuses existing on_key logic — zero duplication

Design decisions

  • Remap over alias: Instead of adding Char('j') at 60+ KeyCode::Down sites, a single remap at the top of on_key is minimal and future-proof
  • Scroll via key synthesis: Converting scroll events to KeyEvent::Up/Down reuses all existing navigation logic without touching any route handler

Remap h/j/k/l to arrow keys after text-input early returns, so all
60+ Up/Down/Left/Right branches work with vim keys automatically.
Filter, editor, and form modes are unaffected.

Also handle MouseEventKind::ScrollUp/ScrollDown in the event loop
by synthesizing arrow key events, enabling scroll wheel navigation.

Closes SaladDay#35

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@SaladDay
Copy link
Owner

感谢你的贡献!!🎉

@SaladDay SaladDay merged commit c09fb8d into SaladDay:main Feb 22, 2026
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.

[Feature Request] 有无计划支持鼠标点击与VIM模式?

2 participants