Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable all input to terminal while a key table is active #2702

Closed
jakenvac opened this issue Nov 4, 2022 · 9 comments
Closed

Disable all input to terminal while a key table is active #2702

jakenvac opened this issue Nov 4, 2022 · 9 comments
Labels
enhancement New feature or request fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds.

Comments

@jakenvac
Copy link
Contributor

jakenvac commented Nov 4, 2022

Hi there, not sure if this already exists but I couldn't find it.

For context:

I have my key table set up to behave modally. I use 'Ctrl + SomeKey' to enter a mode such as pane splitting or resizing. I show which mode I'm in in the right hand status bar.

image
image
image

etc.

A problem I face is that sometimes I forget I'm in a mode and find myself typing a command only to eventually end up accidentally splitting my pane, spawning tabs etc. As a workaround I use the until_unknown in the ActivateKeyTable action to make it so that other keypresses drop me out of the mode. This stops me from accidentally performing actions unless the first key of the command happens to be bound in a mode.

What I'd like to know is would it be possible to disable sending any other key presses to the terminal while one of these key tables are active?

Sorry for the long winded issue. I wasn't sure how else to describe it.

As an aside: I've achieved this modal system with a module I have created to automatically generate these menus and modes as well as assign the key bindings so this feature would be the final piece of the puzzle to make me happy with it for sharing as a 'plugin' of sorts.

@jakenvac jakenvac added the enhancement New feature or request label Nov 4, 2022
wez added a commit that referenced this issue Nov 4, 2022
The behavior is to prevent falling back to a later key table
if no key matched.

refs: #2702
@wez
Copy link
Owner

wez commented Nov 4, 2022

Sounds reasonable. 6aceb97 adds a prevent_fallback boolean to ActivateKeyTable that will prevent falling back to later key tables.

Can you try that and let me know how it goes?
I can then write up the docs for it.

@wez
Copy link
Owner

wez commented Nov 4, 2022

As an aside: I've achieved this modal system with a module I have created to automatically generate these menus and modes as well as assign the key bindings so this feature would be the final piece of the puzzle to make me happy with it for sharing as a 'plugin' of sorts.

Looks great!

@jakenvac
Copy link
Contributor Author

jakenvac commented Nov 4, 2022

Can you try that and let me know how it goes?
I can then write up the docs for it.

Ah absolutely, thanks for the heads up! I don't have a lot of time this afternoon but I'll try to get some feedback to you this weekend.

@jankatins
Copy link
Sponsor Contributor

@jakeHL Any chance to share this code? I would be really interested how to make such tables and such nice UI :-)

@jakenvac
Copy link
Contributor Author

jakenvac commented Nov 5, 2022

I'll be sharing it soon. Few things I want to tidy up first. I'll ping you when it's ready 👍🏻

EDIT: @jankatins here is the initial release. Let me know how you find it!
https://github.com/twilsoft/wezmode

@jakenvac
Copy link
Contributor Author

jakenvac commented Nov 7, 2022

@wez

Sounds reasonable. 6aceb97 adds a prevent_fallback boolean to ActivateKeyTable that will prevent falling back to later key tables.

I built with the latest commit on main and tried the prevent fallback behavior. I'm not sure if I'm doing something wrong but it seems like no keypresses at all are being registered once I've activated a key table. I'm unable to exit the table with PopKeyTable or perform any other actions.

wez added a commit that referenced this issue Nov 7, 2022
@wez
Copy link
Owner

wez commented Nov 7, 2022

@jakeHL ah, I think I see the issue. Try with the latest main?

@jakenvac
Copy link
Contributor Author

jakenvac commented Nov 7, 2022

@wez It works great now, thanks!

wez added a commit that referenced this issue Nov 13, 2022
@wez wez added the fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. label Nov 14, 2022
@wez wez closed this as completed Nov 14, 2022
@github-actions
Copy link

github-actions bot commented Feb 3, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds.
Projects
None yet
Development

No branches or pull requests

3 participants