]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ptyfwd: document why we only honour two of the three kinds of ST
authorLennart Poettering <lennart@poettering.net>
Thu, 31 Oct 2024 09:10:37 +0000 (10:10 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 31 Oct 2024 10:38:18 +0000 (11:38 +0100)
src/shared/ptyfwd.c

index 11701f676874448eefad0f0d85e8153f88f3bac0..34b24837ef142ce990b0ef617aec5c33193093fd 100644 (file)
@@ -507,11 +507,16 @@ static int pty_forward_ansi_process(PTYForward *f, size_t offset) {
                         } else {
                                 /* Otherwise, the OSC sequence is over
                                  *
-                                 * There are two allowed ways to end an OSC sequence:
-                                 * BEL '\x07'
-                                 * String Terminator (ST): <Esc>\ - "\x1b\x5c"
-                                 * since we cannot lookahead to see if the Esc is followed by a \
-                                 * we cut a corner here and assume it will be \. */
+                                 * There are three documented ways to end an OSC sequence:
+                                 *     1. BEL aka ^G aka \x07
+                                 *     2. \x9c
+                                 *     3. \x1b\x5c
+                                 * since we cannot look ahead to see if the Esc is followed by a "\"
+                                 * we cut a corner here and assume it will be "\"e.
+                                 *
+                                 * Note that we do not support \x9c here, because that's also a valid UTF8
+                                 * codepoint, and that would create ambiguity. Various terminal emulators
+                                 * similar do not support it. */
 
                                 if (IN_SET(c, '\x07', '\x1b')) {
                                         r = insert_window_title_fix(f, i+1);