Textualize / textual

The lean application framework for Python. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal and a web browser.
https://textual.textualize.io/
MIT License
25.84k stars 800 forks source link

Textarea, what is ctrl+w should be ctrl+backspace, but that wont work, why? #5134

Open BurnoutDV opened 1 month ago

BurnoutDV commented 1 month ago

So I had small look around and found https://github.com/Textualize/textual/issues/3440 I skimmed it and i am not entirely sure if its totally relevant, but it probably is. To my problem:

When you use a word processor, editor or any input under Linux or Windows, generally ctrl+backspace works as delete_word_left which is actually a function bound to ctrl+w for text area widgets. I was about to make a pull request for this obvious oversight but you guys already had implemented the function. So I thought its a me problem and I just create "TextArea2" for personal use, but it seems, ctrl+backspace is in general not a key binding that is going to work. I assume the problem is deeper.

Since I learned about ctrl+backspace its the most used feature in any text editor, just so handy to delete the entire word and rewritting instead of backspacing. I know this is a console emulator and I only tested Konsole and xterm, and yet, I would really love to have the familiar keybinding instead of the rather unintuitive ctrl+w.

I am mostly looking for info as a quick delve dredged nothing up. Thanks for the awesome work!

github-actions[bot] commented 1 month ago

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

willmcgugan commented 1 month ago

Not all terminals can detect such key combinations. terminal.app on macOS for instance, can't detect ctrl+backspace. Newer terminals (most of them at this point) support an updated key protocol, and can detect ctrl+backspace.

If you run the following command, you will be able to see exactly what your terminal is producing:

textual keys

I suspect we went with ctrl+w because it is universally supported. But we could bind both key combos. @darrenburns what do you think?

BurnoutDV commented 1 month ago

Ah i see, Konsole (the KDE default one) is indeed unable to and registers it as just backspace. Thanks for your time.

darrenburns commented 1 month ago

We could register ctrl+backspace for those terminals that do support it, but even then it's not standard (MacOS uses option+backspace for the same purpose).