gphalkes / tilde

The Tilde text editor
389 stars 20 forks source link

Tilde can't read its config file in byobu, screen or term #55

Closed Linguista closed 4 years ago

Linguista commented 4 years ago

What OS are you using (including version): Ubuntu 18.04 server, Ubuntu 19.04 desktop, KDE Neon 5.16.

What terminal were you running Tilde on when you ran into the issue: Konsole, Tilda, Yakuake, Guake and others.

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

$ tilde --version
Tilde version 1.0.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.4.9
  libt3key (through libt3widget) 0.2.8
  libt3widget 1.0.6
  libt3window 0.3.2
  libtranscript 0.3.3
  libunistring 9.9.?

When using tilde directly in a terminal, it reads its config file at ~/.config/tilde/config and my customizations are loaded. New customizations I make are saved here, too. All is working as it should.

However, when using tilde inside byobu, screen or tmux, tilde does not read its own config file. Furthermore, it cannot load this config file manually, even with the --config=/path/to/config/file option. Instead, it acts as if it has never run before -- the default settings are used and tilde shows the initial input configuration dialog screen.

Configuration changes made inside byobu, screen and tmux are then saved and preserved, but in a different file that I cannot locate. I can only confirm that configuration changes made inside these terminal multiplexers are not saved in ~/.config/tilde/config.

The expected behavior is that tilde read its config file at ~/.config/tilde/config in all cases.

gphalkes commented 4 years ago

I think the unexpected behavior comes from the following: screen, tmux and other terminal multiplexers are in fact terminals themselves. This can be most easily seen by checking the value of the TERM variable after starting such a terminal multiplexer. For example, if I run echo "$TERM" on within a screen session, on my machine, it prints "screen", rather than the value it normally prints on that terminal (e.g. "xterm"). This is for good reason, as the screen session may later be attached to a different terminal, which uses different control sequences etc. The programs running inside the screen session don't know about this, and would happily continue to send the control sequences for the previous terminal that the screen session was attached to.

So Tilde also treats screen, tmux etc. as separate terminals. Therefore, you get the input configuration screen again, and settings such as colors are saved separately. (For colors you can use "Save as default" to ensure they are used on all terminals.) The contents of ~/.config/tilde/config should reflect this. For example, my config contains a section that looks like this:

%terminals { name = "screen" key_timeout = 100 }

which contains the settings for the "screen" terminal type.

I hope this clears up the unexpected behavior. If not, please let me know and I will try to figure out what is going on further.

Linguista commented 4 years ago

Very clear explanation. Thanks a lot. For now, I just copied the contents of the config entry for the terminal I customized into the entries for other terminals. Seems to work fine except on my tmux, which for whatever reason has less than 256 colors.

And by the way, thanks so much for Tilde -- It's the terminal text editor I've been wanting for YEARS!

gphalkes commented 4 years ago

And by the way, thanks so much for Tilde -- It's the terminal text editor I've been wanting for YEARS!

I got tired of waiting ;-)

As for the tmux issue: have you tried passing the -2 flag to it? I think tmux may have difficulty determining the number of colors the terminal supports, and the -2 flag should force it to assume 256 colors.

Linguista commented 4 years ago

The -2 flag hasn't worked so far for some reason, but this has:

echo "set -g default-terminal \"screen-256color\"" > ~/.tmux.conf

It also works with tmux-256-color.