[newlib-cygwin] Cygwin: console: Ignore intermediate byte in CSI sequence

Takashi Yano tyan0@sourceware.org
Sun Dec 8 13:34:38 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=2a1f407b0919c809bace9522abcfee8059d5c840

commit 2a1f407b0919c809bace9522abcfee8059d5c840
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Sun Dec 8 22:27:03 2024 +0900

    Cygwin: console: Ignore intermediate byte in CSI sequence
    
    Recent vim throughs the sequence CSI '0%m' that cannot be handled
    appropriately by psuedo console for a test purpose. This patch
    removes the intermediate byte ('%') from the sequence.
    
    Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>

Diff:
---
 winsup/cygwin/fhandler/console.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
index 0660ee305..c6c261420 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -4024,6 +4024,11 @@ fhandler_console::write (const void *vsrc, size_t len)
 	case gotcommand:
 	  if (con.nargs < MAXARGS)
 	    con.nargs++;
+	  if (*src == '%' && con.nargs == 1 && con.args[0] == 0)
+	    { /* Ignore intermediate byte in CSI sequence used by vim. */
+	      src++;
+	      break;
+	    }
 	  char_command (*src++);
 	  con.state = normal;
 	  wpbuf.empty();


More information about the Cygwin-cvs mailing list