public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: console: Add workaround for windows xterm compatible mode bug.
@ 2019-08-12 15:14 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-08-12 15:14 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=33a21904a702191cebf0e81b4deba2dfa10a406c
commit 33a21904a702191cebf0e81b4deba2dfa10a406c
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Mon Aug 12 22:47:42 2019 +0900
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.
Diff:
---
winsup/cygwin/fhandler_console.cc | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index df28c7f..b46a4d5 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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-12 15:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 15:14 [newlib-cygwin] Cygwin: console: Add workaround for windows xterm compatible mode bug Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).