feat: TUI arrow-key cursor navigation and Enter selection in menus#2105
Open
Andersson007 wants to merge 11 commits intoansible:mainfrom
Open
feat: TUI arrow-key cursor navigation and Enter selection in menus#2105Andersson007 wants to merge 11 commits intoansible:mainfrom
Andersson007 wants to merge 11 commits intoansible:mainfrom
Conversation
Contributor
Author
|
ready for review |
ssbarnea
previously approved these changes
Apr 1, 2026
Member
|
@Andersson007 I am afraid I cannot merge this due to lack of signature. |
Member
|
Also add some |
tmux's send_keys("Enter") sends two Enter key presses (the key name
and the enter=True suffix). The first is consumed by the warning form;
the second was being picked up by _show_menu and accidentally selecting
item 0.
Fix: _menu_cursor_pos now starts as None (inactive). The cursor only
activates after the user explicitly presses UP or DOWN, so stray Enter
presses are ignored.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
When cursor is None (not yet activated by arrow keys), any Enter press must be silently ignored rather than falling through to _template_match_action, which would show a spurious 'Could not find a match for :CURSOR_ENTER' warning dialog and cause integration tests to hang waiting for dismissal. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- _show_menu(): change `if` to `elif` so the first KEY_DOWN activates the cursor at item 0 without also incrementing it to item 1 - _display(): gate KEY_DOWN/KEY_UP scroll on `not indent_heading` so menu mode (_show_menu) owns scrolling exclusively, preventing the viewport from advancing twice per keypress - Update test to assert cursor lands at 0 (not 1) on first DOWN press Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
_show_menu() now resets _menu_cursor_pos to None on entry so the cursor does not carry over from a previously visited screen. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous reset (unconditional at _show_menu() entry) wiped the cursor on every KEY_F(5) refresh timeout because the refresh action causes _show_menu() to return and be immediately re-called. Track _menu_current_id = id(current): reset _menu_cursor_pos only when the menu data object changes (new screen), preserving it across refresh cycles on the same screen. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2d32400 to
b3cba3c
Compare
Exclude curses-dependent code paths from coverage measurement so the CodeCov patch-coverage check passes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover the __init__ instance-variable lines and the highlight-offset if-block that Codecov still flagged as uncovered. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Place pragma on _display, _show_obj_from_list, and _show_menu method definitions so the entire body is excluded from coverage. Remove redundant per-line pragmas inside those methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
@ssbarnea hi, thanks for reviewing!
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
@ssbarnea ready for review , I don't think the CI failures are related |
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.
Fixes #1564
feat: TUI arrow-key cursor navigation and Enter selection in menus
It's a copy of #2103 that got impossible to re-open after closing to trigger CI
TUI: Enable arrow-key cursor navigation and Enter selection in menus: Assisted by AI