weechat icon indicating copy to clipboard operation
weechat copied to clipboard

terminal title resets on resize / alt+l

Open ksu-0 opened this issue 4 years ago • 3 comments

Bug summary

If value of weechat.look.window_title is changed, both terminal resize and /window bare reset window title to the value it had immediately after startup.

Steps to reproduce

  • /set weechat.look.window_title a
  • /quit
  • start again: xterm -e weechat
  • /set weechat.look.window_title b
  • resize the terminal

Current behavior

Window title resets to a.

Expected behavior

Window title should remain b.

Additional information

  • WeeChat version: 3.3-1
  • OS, distribution and version: Linux, Debian testing
  • Terminal: tested in xfce4-terminal 0.8.10-1 and xterm 369-1, with TERM=xterm-256color
  • Terminal multiplexer (screen/tmux/…/none): none

ksu-0 avatar Sep 29 '21 19:09 ksu-0

Note that this does not happen in all terminal emulators.

It happens in xterm, gnome-terminal and alacritty.

It does not happen in kitty, wezterm, urxvt and konsole.

trygveaa avatar Sep 29 '21 21:09 trygveaa

So the issue is that WeeChat sets the title when it starts and then it prints CSI 22;0;0t which is Save xterm icon and window title on stack.. Then when you set a new title, it does not print this escape sequence to save it to the stack. And when you resize the window or change to bare mode, it prints CSI 23;0;0t which is Restore xterm icon and window title from stack. (and 22 again to put it on the stack again, but that doesn't matter here). I assume it's ncurses printing these sequences to save and restore the title from the stack.

Don't know enough about ncurses to say what the correct way to change the title is, or why ncurses is printing these sequences to save and restore the title from the stack. I guess one fix could be to pop the title stack before setting the title and save it again afterwards.

trygveaa avatar Sep 29 '21 22:09 trygveaa

Just FYI there is an extra 0 in those sequences, see XTWINOPS here: https://fossies.org/linux/xterm/ctlseqs.txt#l_1440 I am guessing xterm and gnome-terminal ignore the extra 0

kovidgoyal avatar Sep 30 '21 03:09 kovidgoyal