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.y...@nifty.ne.jp>
---
 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();
-- 
2.45.1

Reply via email to