You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this application which has key bindings under normal circumstances. But when I press a certain key, I want to display a prompt where the user can enter some text. The key bindings should be disabled at this point. On pressing Enter, the input field should be hidden again, bindings re-enabled, and I should get the text to handle.
The conditional container is working well, and the TextArea with the prompt prefix is showing when I use the / key binding. The counter is counting, and the FormattedTextControl is updating on each keypress. The problem is that any text entered after / never appears on screen. Perhaps it's being collected in some buffer, but I can't access it. The key bindings have been successfully disabled while the TextArea is shown. But Enter doesn't work, so there's no way to get out of the dialog and back to the rest of the application and its key bindings. In fact, the acceptInput method is never called.The app also doesn't respond to Ctrl-C or even Ctrl-Z. So entering this state completely locks up the terminal and I have to close the tab entirely.
I have to believe there's something simple that I'm missing, but this code looks the same to me as what's in the pwdmgr.py file. Do I need to do something to give focus to the TextArea? What am I doing wrong??
OK, I don't understand all of what I was seeing yesterday. But the main problem was that I wasn't passing multiline=False to the instantiation of TextArea. Without that, Enter just adds a newline to the buffer and wraps the text so that the line before is hidden (in a 1-line Window). By turning off multiline, Enter instead sends the text to acceptInput(). You also need to clear the input buffer before display:
I have this application which has key bindings under normal circumstances. But when I press a certain key, I want to display a prompt where the user can enter some text. The key bindings should be disabled at this point. On pressing Enter, the input field should be hidden again, bindings re-enabled, and I should get the text to handle.
Based on this comment and the code it pointed to (thanks @rogerbassons!), I have come up with this… which almost works.
The conditional container is working well, and the
TextArea
with the prompt prefix is showing when I use the/
key binding. The counter is counting, and the FormattedTextControl is updating on each keypress. The problem is that any text entered after/
never appears on screen. Perhaps it's being collected in some buffer, but I can't access it. The key bindings have been successfully disabled while theTextArea
is shown. But Enter doesn't work, so there's no way to get out of the dialog and back to the rest of the application and its key bindings. In fact, theacceptInput
method is never called.The app also doesn't respond to Ctrl-C or even Ctrl-Z. So entering this state completely locks up the terminal and I have to close the tab entirely.I have to believe there's something simple that I'm missing, but this code looks the same to me as what's in the
pwdmgr.py
file. Do I need to do something to give focus to the TextArea? What am I doing wrong??The text was updated successfully, but these errors were encountered: