mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #1003] Feature Request: Support hjkl navigation in TUI modals. #724
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#724
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @F1bonacc1 on GitHub (Jun 28, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/1003
Feature Request
Allow using
hjklbinding in modal dialogs as an alternative to arrow navigation.Use Case:
Vimmers wanting to vim everywhere
Original issue: https://github.com/F1bonacc1/process-compose/issues/193
@kivattt commented on GitHub (Jun 29, 2024):
You can add
hjklnavigation by using SetInputCapture on the modalThis is what I've done before to add it to modals:
github.com/kivattt/fen@83643815f7/main.go (L271)@F1bonacc1 commented on GitHub (Jun 29, 2024):
Thanks @kivattt,
That will work for sure. Wouldn't it be better to make it consistent with other widgets in which
hjklis already supported?@rivo commented on GitHub (Jul 8, 2024):
To be honest, I think it was a mistake to add vim-like navigation to
tview. At first, I did it because there are many vim users out there (myself included) and most widgets in the initial version of this package were read-only so it didn't hurt to add these keybinds. However, this doesn't work with widgets likeInputFieldor the later introducedTextArea. At least not without adding modes. (And that's definitely something that's not going to be added totview.) The bash-like / readline type of keybinds which use Ctrl lend themselves better to the widgets offered in this library, as they don't interfere with normal text input.I know we're now left with a somewhat inconsistent state of affairs because of the backwards compatibility promise. I'm not going to remove these keybinds but I probably won't add new ones. As @kivattt mentioned, people can always customize their widgets to their liking.
I'm working on an API which will make it easier to add these kind of changes to widgets. Then you might even be able to include a third-party package that will enable vim-like navigation across the board.
@F1bonacc1 commented on GitHub (Jul 8, 2024):
Thank you @rivo for the detailed answer.
In this case, I will use @kivattt's suggestion.
Thanks again for this amazing library!