diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2020-02-27 00:33:01 +0900 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2020-02-26 21:17:36 +0100 |
commit | 0d7bbc0bc3da7d7c9e0a76243cbeaf458724d32d (patch) | |
tree | f85739d323054fe96ab571300351cce0dd9e5436 /winsup/cygwin/fhandler_console.cc | |
parent | 3b42762e0b02ad53cc01dd752b94a044b7a42ebf (diff) | |
download | newlib-0d7bbc0bc3da7d7c9e0a76243cbeaf458724d32d.zip newlib-0d7bbc0bc3da7d7c9e0a76243cbeaf458724d32d.tar.gz newlib-0d7bbc0bc3da7d7c9e0a76243cbeaf458724d32d.tar.bz2 |
Cygwin: console: Add support for REP escape sequence to xterm mode.
- In Win10 upto 1809, xterm compatible mode does not have REP
escape sequence which terminfo declares. This patch adds support
for "CSI Ps b" (REP). With this patch, bvi (binary editor) works
normally in Win10 1809. Also, xterm compatible mode does not have
"CSI Pm `" (HPA), "CSI Pm a" (HPR) and "CSI Ps e" (VPR). However,
they do not appear to be declared by terminfo. Therefore, these
have been pending.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index fbeccff..f87d932 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -62,6 +62,7 @@ static struct fhandler_base::rabuf_t con_ra; #define WPBUF_LEN 256 static unsigned char wpbuf[WPBUF_LEN]; static int wpixput; +static unsigned char last_char; #define wpbuf_put(x) \ wpbuf[wpixput++] = x; \ if (wpixput > WPBUF_LEN) \ @@ -2009,6 +2010,37 @@ fhandler_console::char_command (char c) DWORD wn; switch (c) { +#if 0 /* These sequences, which are supported by real xterm, are + not supported by xterm compatible mode. Therefore they + were implemented once. However, these are not declared + in terminfo of xterm-256color, therefore, do not appear + to be necessary. */ + case '`': /* HPA */ + if (con.args[0] == 0) + con.args[0] = 1; + cursor_get (&x, &y); + cursor_set (false, con.args[0]-1, y); + break; + case 'a': /* HPR */ + if (con.args[0] == 0) + con.args[0] = 1; + cursor_rel (con.args[0], 0); + break; + case 'e': /* VPR */ + if (con.args[0] == 0) + con.args[0] = 1; + cursor_rel (0, con.args[0]); + break; +#endif + case 'b': /* REP */ + wpbuf_put (c); + if (wincap.has_con_esc_rep ()) + /* Just send the sequence */ + WriteConsoleA (get_output_handle (), wpbuf, wpixput, &wn, 0); + else if (last_char && last_char != '\n') + for (int i = 0; i < con.args[0]; i++) + WriteConsoleA (get_output_handle (), &last_char, 1, &wn, 0); + break; case 'r': /* DECSTBM */ con.scroll_region.Top = con.args[0] ? con.args[0] - 1 : 0; con.scroll_region.Bottom = con.args[1] ? con.args[1] - 1 : -1; @@ -2746,6 +2778,7 @@ fhandler_console::write_normal (const unsigned char *src, break; default: found += ret; + last_char = *(found - 1); break; } } |