Is there any way to close the input panel that gets opened up at the bottom of the screen programmatically? The user can close it either via the enter
or esc
keys. I’d like to be able to close/hide it in the on_change
callback depending on what the user has entered without them having to hit the enter
key.
To get more specific about what I’m trying to do:
I’ve got a plugin called EasyMotion (https://github.com/tednaleid/sublime-EasyMotion, renamed from SublimeJump because PackageControl strongly suggests that plugins not be named starting with “Sublime”).
To use it, the user presses the shortcut followed by a visible character that they’d like to move the cursor to. I then change all of the visible instances of that character to one of a-z0-9A-Z
and open up the show_input_panel for them to pick which one they want to go to.
Here is the github issue that describes what I want as well as some other people saying that it’s a feature they’d like: https://github.com/tednaleid/sublime-EasyMotion/issues/5
Then they enter the letter of the instance they want to move the cursor to and have to hit enter. I’d rather they not have to hit “enter” as it’s redundant. I never want more than one character. There’s no way for me to stop the user from typing more than one character in the input box.
If there are alternative ways that I can gather a single character of input from the user when the plugin is active, I’d be interested in knowing that. From what I can tell, using show_overlay
won’t work for me as it seems more specialized and using show_quick_panel
isn’t good because it occludes a large part of the screen that has a good chance of containing the character the user wants to jump to.
Ideally, I’d actually be able to capture a character of input without any sort of UI at all when the plugin is active. Similar to how vintage mode does things, but that looks like I’d need to implement an entire mode for that to work (maybe that’s not as hard as I’m thinking it is…).