Skip to content

feat(status): debounce arrow-key edge navigation (#2898)#2939

Open
leno23 wants to merge 1 commit into
gitui-org:masterfrom
leno23:feat/arrow-edge-navigation-guard-2898
Open

feat(status): debounce arrow-key edge navigation (#2898)#2939
leno23 wants to merge 1 commit into
gitui-org:masterfrom
leno23:feat/arrow-edge-navigation-guard-2898

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

Implements the debounce approach from #2898 for the status tab and full-screen diff:

  • New KeyRepeatGuard records arrow key presses and blocks edge navigation (switching panels / leaving diff) if the same key was pressed within the last 500ms.
  • Status tab: WorkDir ↔ Stage (move_down / move_up) and leaving diff via move_left at horizontal scroll edge.
  • Diff: move_left returns NotConsumed when horizontal scroll cannot move further, so status can handle exit with the guard.

Autorepeat scrolling no longer accidentally jumps panels; press the arrow key again after a brief pause to switch intentionally.

Closes #2898 (partial — commit message textarea and other scrollable popups can follow in a follow-up).

Test plan

  • cargo test -p gitui key_repeat_guard
  • Manual: hold Down at bottom of WorkDir list — should not jump to Stage until key released and pressed again
  • Manual: hold Left in diff at left edge — should not unfocus diff until key released and pressed again
  • Manual: single deliberate arrow at edge still switches after idle gap

Made with Cursor

Add KeyRepeatGuard so panel switches at scroll edges only fire if the
same arrow key was idle for 500ms, reducing accidental jumps from
autorepeat. Applies to status tab focus changes and diff horizontal exit.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

UX: Wherever Arrow keys may scroll or switch to other view, switch only if no scroll happened in last 0.5 s

1 participant