gphalkes / tilde

The Tilde text editor
395 stars 21 forks source link

Backspace deletes whole word by default #74

Closed jubie25 closed 3 years ago

jubie25 commented 3 years ago

What OS are you using (including version):

Debian Stretch / Ubuntu Xenial / Debian Buster

What terminal were you running Tilde on when you ran into the issue:

SSH / Linux shell

Please paste the result of running 'tilde --version':

~# tilde --version Tilde version 1.1.2 Copyright (c) 2011-2018 G.P. Halkes Tilde is licensed under the GNU General Public License version 3 Library versions: libt3config 1.0.0 libt3highlight 0.5.0 libt3key (through libt3widget) 0.2.10 libt3widget 1.2.0 libt3window 0.4.0 libtranscript 0.3.3 libunistring 0.9.?

Please describe the problem. If possible, include the action you performed, the expected result and the actual result in the description.

Editor does delete whole words when pressing Backspace (not only one character). Ctrl-Backspace does delete the left character only. Didn't find a switch to delete just one character by default when pressing backspace.

Notice: this version does NOT show this odd behaviour (Debian Buster): ~# tilde --version Tilde version 1.0.0 Copyright (c) 2011-2018 G.P. Halkes Tilde is licensed under the GNU General Public License version 3 Library versions: libt3config 0.2.11 libt3highlight 0.4.6 libt3key (through libt3widget) 0.2.9 libt3widget 1.0.3 libt3window 0.3.2 libtranscript 0.3.3 libunistring 9.10.?

jubie25 commented 3 years ago

Update: Ubuntu 20.04 mini (often used for servers) also shows the unwanted behaviour. Are there any comments for it? Would be a great sorrow to learn that tilde is dead...

gphalkes commented 3 years ago

Sorry for not responding earlier. I don't have much time to spend on Tilde at the moment, but it is important to me that Tilde keeps working.

I am unfortunately not able to replicate the described behavior, but it is certainly not the intended behavior. Typically such behaviors are caused by incorrect settings of the TERM variable or different behaviors of terminals that claim to be a particular type. SSH is particularly problematic in this regard, as it takes the TERM variable from the client system, but the key definitions from the server system as the software (in this case Tilde) is running there.

For most keys it is easy to visualize what key codes they produce, but unfortunately this is not as easy for the backspace key. For this you could use the t3learnkeys command (part of the libt3key-bin package on Debian and Ubuntu). As we are simply interested in the backspace key for this case and not for learning the entire set of keys, simply enter a bogus number for the number of function keys and a hyphen (-) when it is asking for extra modes. Then, once it starts asking you to press the Insert key, simply press first backspace and then ctrl-backspace. After this you can quit the program by pressing control+c and then y to confirm.

The expected result is the following:

Learning keys for terminal linux. Please press the requested key or enter WARNING: Be carefull when pressing combinations as they may be bound to actions you don't want to execute! For best results don't run this in a window manager. How many function keys does your keyboard have? 12 Make sure that NumLock is disabled before starting Name for extra mode (- to continue): - Starting mode nokx (press Control R to restart) Insert \177 Home \010 Page Up ^C Are you sure you want to quit [y/n]?

As you can see, on my Ubuntu 20.04 system the backspace key triggers key code \177 (this is octal, so the code in decimal is 127). When pressing ctrl+backspace (listed at Home) the resulting code is \010 (i.e. 8 decimal). This is also what all systems I have tested so far use, and what is encoded in the files under /usr/share/libt3key1/ where Tilde gets its key mappings.

Could you provide the results from the situation where Tilde does the wrong thing? And the value of the TERM variable would be useful as well (can be printed by running: echo $TERM).

jubie25 commented 3 years ago

Thanks a lot for responding and giving the chance to help. As a desktop windows user tilde is the editor that imposes the least barriers when dealing with my linux servers. At least I'm not interested in learning using countless editors but in editing text files... :-) I'm using MobaXTerm as favorite Windows SSH-Client. And your post showed me the direction to search for. In fact, the observed behaviour has NOTHING to do with tilde but with a quite unconventional and surprising default setting in MobaXTerm:

Unbenannt

Unchecking the "backspace sends Ctrl-H" solves all problems. Thanks a lot!!

gphalkes commented 3 years ago

That is indeed a rather surprising setting. I'm glad you were able to find the cause of this issue, and thank you for reporting your findings back on the bug for other users to find!