Version: 2.4.1 (using KDE 4.4.1) OS: Linux Installed from: Archlinux Packages TL;DR summary: Konsole should treat "\e]0;<title>\e\\" (set window title) the same way it interprets "\e]0;<title>\007". I have this string as part of my $PS1 ('bash' prompt string): \e]0;<title>\e\\ This is supposed to set the window title in Xterm-compatible terminal emulators. However, Konsole 2.4.1 (KDE 4.4.1) does not support this and reports an error: Undecodable sequence: \001b(hex)\\ It seems that Konsole does not recognize the standard string terminator sequence "\e\\" (ESC \). Everything works fine if I use "\007" (BEL) as string terminator, but I would prefer to use the standard one. According to <http://invisible-island.net/xterm/xterm.faq.html#how2_title>: # The terminator "\007" is a problem area. Xterm historically uses this character, though it is non-ANSI. The "correct" character should be a "\233" string terminator, or "\033\\", which is the 7-bit equivalent. XFree86 xterm recognizes either (the "\007" or string terminator); waiting for the first of these. Most other terminal emulators also accept both "\007" and "\033\\" - I tested VTE-based ones qw[roxterm xfce4-terminal gnome-terminal], rxvt, and PuTTY. Konsole is the only one so far that requires "\007".
Created attachment 87450 [details] untested patch haven't tested this, but I think it should fix it.
Git commit 5601e995bd8715ea9e186e447a947cd48736bfee by Kurt Hindenburg. Committed on 28/01/2017 at 15:22. Pushed by hindenburg into branch 'master'. Allow ANSI string terminator to work Treat "\e]0;<title>\e\\" (set window title) the same way it interprets "\e]0;<title>\007". It seems that Konsole does not recognize the standard string terminator sequence "\e\\" (ESC \). Everything works fine if I use "\007" (BEL). <http://invisible-island.net/xterm/xterm.faq.html#how2_title> Thanks to Aniketh Girish anikethgireesh gmail com and Martin Sandsmark martin sandsmark kde org for patch/review REVIEW:129895 M +1 -1 src/Vt102Emulation.cpp https://commits.kde.org/konsole/5601e995bd8715ea9e186e447a947cd48736bfee
Bug was not totally fixed with this patch, and introduced a different bug. The patch (which is now released) compares the character against decimal 33, which is actually !, not ESC. This creates a bug where if a ! appears in the terminal title, it's treated as the end of the title, and the rest of the title (including the ESC or BEL) is printed normally. Comparing against octal 033 or decimal 27 will properly detect ESC.
Thanks - I wonder how my testing got this to work
Git commit 7a41b73b46d1f774e82eb64a8b66920e411ccd3c by Kurt Hindenburg. Committed on 05/05/2017 at 12:11. Pushed by hindenburg into branch 'master'. Correct ANSI string terminator Use the correct decimal value 27 In bash, PS1="\e]0;<title>\e\\" or PS1="\e]0;<title>\033" Differential Revision: https://phabricator.kde.org/D5576 M +1 -1 src/Vt102Emulation.cpp https://commits.kde.org/konsole/7a41b73b46d1f774e82eb64a8b66920e411ccd3c
Git commit 355ca4063ced46ea990e68e5abdda62826386f2c by Kurt Hindenburg. Committed on 07/05/2017 at 13:46. Pushed by hindenburg into branch 'Applications/17.04'. Correct ANSI string terminator Use the correct decimal value 27 In bash, PS1="\e]0;<title>\e\\" or PS1="\e]0;<title>\033" Differential Revision: https://phabricator.kde.org/D5576 (cherry picked from commit 7a41b73b46d1f774e82eb64a8b66920e411ccd3c) M +1 -1 src/Vt102Emulation.cpp https://commits.kde.org/konsole/355ca4063ced46ea990e68e5abdda62826386f2c
Reopening, it's not okay in 17.12.3. The command: echo -e '\e]0;Title\e\\' not only sets the title, but also emits a literal backslash. (On a side note, there seems to be a buffer corrpution bug in bash-4.4, causing the particular PS1 that you've mentioned earlier to emit garbage in other terminals too. So don't use PS1 for debugging/verifying this issue :))
Created attachment 115326 [details] Followup fix Followup fix for the erroneously emitted literal backslash. Works for me. Please test thoroughly and adjust to konsole's coding practices or whatever.
Git commit 324d78c07fc4fe2cdb2219a9e042a969df73d39c by Kurt Hindenburg, on behalf of Mariusz Glebocki. Committed on 02/11/2019 at 16:01. Pushed by hindenburg into branch 'master'. Fix OSC sequence parsing printf '\033]2;aaa\033bbb' prints bbb printf '\033]2;aaa\033\\bbb' prints bbb printf '\033]2;aaa\033' prints nothing; title is changed when next character is received. printf '\033]2;aaa\033\\' prints nothing printf '\033]2;aaa\007bbb' prints bbb printf '\033]2;aaa\007\\bbb' prints \bbb printf '\033]2;a\ra\na\033bbb' prints bbb printf '\033]2;a\ra\na\033\\bbb' prints bbb printf '\033]2;a\ra\na\007bbb' prints bbb In each case the title is set to aaa FIXED-IN: 19.12.0 M +39 -25 src/Vt102Emulation.cpp M +1 -1 src/Vt102Emulation.h https://invent.kde.org/kde/konsole/commit/324d78c07fc4fe2cdb2219a9e042a969df73d39c
Git commit 324d78c07fc4fe2cdb2219a9e042a969df73d39c by Kurt Hindenburg, on behalf of Mariusz Glebocki. Committed on 02/11/2019 at 16:01. Pushed by scmsync into branch 'master'. Fix OSC sequence parsing printf '\033]2;aaa\033bbb' prints bbb printf '\033]2;aaa\033\\bbb' prints bbb printf '\033]2;aaa\033' prints nothing; title is changed when next character is received. printf '\033]2;aaa\033\\' prints nothing printf '\033]2;aaa\007bbb' prints bbb printf '\033]2;aaa\007\\bbb' prints \bbb printf '\033]2;a\ra\na\033bbb' prints bbb printf '\033]2;a\ra\na\033\\bbb' prints bbb printf '\033]2;a\ra\na\007bbb' prints bbb In each case the title is set to aaa FIXED-IN: 19.12.0 M +39 -25 src/Vt102Emulation.cpp M +1 -1 src/Vt102Emulation.h https://commits.kde.org/konsole/324d78c07fc4fe2cdb2219a9e042a969df73d39c
This fix appears to have broken tmux copy - https://bugs.kde.org/show_bug.cgi?id=415249