]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: pty: Revise the code which prevents undesired window title.
authorTakashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>
Sun, 31 May 2020 05:53:20 +0000 (14:53 +0900)
committerCorinna Vinschen <corinna@vinschen.de>
Sun, 31 May 2020 08:33:55 +0000 (10:33 +0200)
- In current pty, the window title can not be set from non-cygwin
  program due to the code which prevents overwriting the window
  title to "cygwin-console-helper.exe" in fhandler_pty_master::pty_
  master_fwd_thread(). This patch fixes the issue.

winsup/cygwin/fhandler_tty.cc

index c3d49968d88824344dd5a0722db7b58b8e9d5e0d..e434b7878001d1781d54f1e5b365228b6454bc59 100644 (file)
@@ -3313,9 +3313,14 @@ fhandler_pty_master::pty_master_fwd_thread ()
              }
            else if (state == 4 && outbuf[i] == '\a')
              {
-               memmove (&outbuf[start_at], &outbuf[i+1], rlen-i-1);
+               const char *helper_str = "\\bin\\cygwin-console-helper.exe";
+               if (memmem (&outbuf[start_at], i + 1 - start_at,
+                           helper_str, strlen (helper_str)))
+                 {
+                   memmove (&outbuf[start_at], &outbuf[i+1], rlen-i-1);
+                   rlen = wlen = start_at + rlen - i - 1;
+                 }
                state = 0;
-               rlen = wlen = start_at + rlen - i - 1;
                continue;
              }
            else if (outbuf[i] == '\a')
This page took 0.034303 seconds and 5 git commands to generate.