From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38864 invoked by alias); 12 Aug 2019 15:14:17 -0000 Mailing-List: contact cygwin-cvs-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-cvs-owner@cygwin.com Received: (qmail 38808 invoked by uid 9078); 12 Aug 2019 15:14:17 -0000 Date: Mon, 12 Aug 2019 15:14:00 -0000 Message-ID: <20190812151417.38807.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: console: Add workaround for windows xterm compatible mode bug. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: 92e2c1ad9de2d140374bf789b2eb6142b3297120 X-Git-Newrev: 33a21904a702191cebf0e81b4deba2dfa10a406c X-SW-Source: 2019-q3/txt/msg00039.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=33a21904a702191cebf0e81b4deba2dfa10a406c commit 33a21904a702191cebf0e81b4deba2dfa10a406c Author: Takashi Yano 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; colkill_pgrp (SIGWINCH); return true; }