summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2019-08-12 22:47:42 +0900
committerCorinna Vinschen <corinna@vinschen.de>2019-08-12 17:08:48 +0200
commit33a21904a702191cebf0e81b4deba2dfa10a406c (patch)
tree74774086beab86a7f16716aee2d997a85a5eaf8d
parent92e2c1ad9de2d140374bf789b2eb6142b3297120 (diff)
downloadcygnal-33a21904a702191cebf0e81b4deba2dfa10a406c.tar.gz
cygnal-33a21904a702191cebf0e81b4deba2dfa10a406c.tar.bz2
cygnal-33a21904a702191cebf0e81b4deba2dfa10a406c.zip
Cygwin: console: Add workaround for windows xterm compatible mode bug.
- The horizontal tab positions are broken after resizing console window. This seems to be a bug of xterm compatible mode of windows console. This workaround fixes this problem.
-rw-r--r--winsup/cygwin/fhandler_console.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index df28c7f93..b46a4d513 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -327,6 +327,25 @@ fhandler_console::send_winch_maybe ()
{
con.scroll_region.Top = 0;
con.scroll_region.Bottom = -1;
+ if (wincap.has_con_24bit_colors ())
+ {
+ /* Workaround for a bug of windows xterm compatible mode. */
+ /* The horizontal tab positions are broken after resize. */
+ DWORD dwLen;
+ CONSOLE_SCREEN_BUFFER_INFO sbi;
+ GetConsoleScreenBufferInfo (get_output_handle (), &sbi);
+ /* Clear all horizontal tabs */
+ WriteConsole (get_output_handle (), "\033[3g", 4, &dwLen, 0);
+ /* Set horizontal tabs */
+ for (int col=8; col<con.dwWinSize.X; col+=8)
+ {
+ char buf[32];
+ __small_sprintf (buf, "\033[%d;%dH\033H", 1, col+1);
+ WriteConsole (get_output_handle (), buf, strlen (buf), &dwLen, 0);
+ }
+ /* Restore cursor position */
+ SetConsoleCursorPosition (get_output_handle (), sbi.dwCursorPosition);
+ }
get_ttyp ()->kill_pgrp (SIGWINCH);
return true;
}