Ideal terminal settings to run Tilde

13 views
Skip to first unread message

Rob Gamble

unread,
Oct 22, 2019, 9:13:46 AM10/22/19
to Tilde text editor
Tilde is by far my favorite CLI editor on Linux.  My only issue is that when I launch Tilde from different terminals, I get differing levels of functionality.  For example, Shift-arrows do not make a selection when launched from PuTTY, but it works fine from the Chrome SSH extension.

I'm sure terminal emulation is responsible for the differences, not Tilde.  How can I learn more about differing terminal types so I can get a consistent experience regardless of how I connect?  There's a lot of information about terminal emulation, and I doubt all of it is relevant to my issue.

Michael Perryman

unread,
Oct 23, 2019, 4:40:18 AM10/23/19
to Tilde text editor

On Tuesday, October 22, 2019 at 2:13:46 PM UTC+1, Rob Gamble wrote:
Tilde is by far my favorite CLI editor on Linux.  My only issue is that when I launch Tilde from different terminals, I get differing levels of functionality.  For example, Shift-arrows do not make a selection when launched from PuTTY, but it works fine from the Chrome SSH extension.

I'm sure terminal emulation is responsible for the differences, not Tilde.  How can I learn more about differing terminal types so I can get a consistent experience regardless of how I connect?  There's a lot of information about terminal emulation, and I doubt all of it is relevant to my issue.

I had the same problem & so contacted Gertjan Halkes the author. He supplied a another xterm file that I had to copy to /usr/share/libt3key1/xterm My problem was with Raspbian, based on Debian Buster, the terminal was being reported as the wrong terminal. I don’t know where Gertjan has put that file to be downloaded by anyone.


Michael


Gertjan Halkes

unread,
Nov 8, 2019, 9:56:48 AM11/8/19
to Tilde text editor
Hi Rob,

Sorry for the late reply, I've been rather busy recently.

Unfortunately, there isn't a great deal of documentation for most terminal emulators. One way of figuring out what capabilities a terminal provides is by simply running 'cat' on the command line and pressing keys. When trying to figure out if the terminal sends different key codes with and without pressing shift for example, first press the key without shift, then try again while holding shift down. If you see the same thing twice, the terminal doesn't send a different key code. For example, for the right arrow key in xterm, I get the following:

$ cat
^[[C^[[1;2C^C

To explain what you see in more detail: pressing right arrow results in ^[ (which is displayed for the escape byte 0x1B), and then the characters [ and C. Then I pressed shift + right arrow, which results in ^[, [, 1, ;, 2, and finally C. Then I pressed ctrl+C to end the program, resulting in the ^C.

This doesn't always present the entire story though. Most terminal emulators have an extra mode, called keypad transmit mode, which changes the key codes sent by some or all of the keys. To test this, you can use the tput program. If I do the same as above, but using the tput program to switch to keypad transmit mode, we get the following:

$ tput smkx
$ cat
^[OC^[[1;2C^C
$ tput rmkx

As you can see, the code for the right arrow key changed. The second tput command is to make sure we set the terminal back to its original settings.

With this, you should be able to figure out exactly what key codes are produced.

There is, however, one more thing to be aware of. To determine the terminal type that a program is talking to, the terminal sets the value of the environment variable TERM. There are unfortunately quite a few terminal emulators which set the value xterm or similar, but which aren't fully compatible with xterm. Particularly in the generated key codes there can be significant differences. There are reasons for doing this (which are too long to explain here), but it is not a great practice. Putty in particular used to do this. So check this variable as well.

Cheers,
Gertjan
Reply all
Reply to author
Forward
0 new messages