public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-patches@cygwin.com
Subject: [PATCH] Cygwin: console: Call fix_tab_position() only if having broken tabs.
Date: Sun, 20 Feb 2022 20:16:36 +0900	[thread overview]
Message-ID: <20220220111636.1000-1-takashi.yano@nifty.ne.jp> (raw)

- Calling fix_tab_position() is necessary in Windows 10 with xterm
  compatible mode enabled, because it has a problem that the tab
  positions will be broken when the window size is changed. Fortunately,
  this problem has been fixed in Windows 11. Therefore, with this patch,
  necessity of fix_tab_position() call is determined by referring to
  wincap.has_con_broken_tabs(), which is recently introduced.
---
 winsup/cygwin/fhandler_console.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 1dfe8e0c7..03ec88804 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -286,7 +286,8 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty *ttyp)
 		{
 		  con.scroll_region.Top = 0;
 		  con.scroll_region.Bottom = -1;
-		  if (wincap.has_con_24bit_colors () && !con_is_legacy)
+		  if (wincap.has_con_24bit_colors () && !con_is_legacy
+		      && wincap.has_con_broken_tabs ())
 		    fix_tab_position (p->output_handle);
 		  ttyp->kill_pgrp (SIGWINCH);
 		}
@@ -664,7 +665,8 @@ fhandler_console::send_winch_maybe ()
     {
       con.scroll_region.Top = 0;
       con.scroll_region.Bottom = -1;
-      if (wincap.has_con_24bit_colors () && !con_is_legacy)
+      if (wincap.has_con_24bit_colors () && !con_is_legacy
+	  && wincap.has_con_broken_tabs ())
 	fix_tab_position (get_output_handle ());
       get_ttyp ()->kill_pgrp (SIGWINCH);
       return true;
@@ -2321,7 +2323,7 @@ fhandler_console::char_command (char c)
 		  if (con.args[i] == 1049)
 		    {
 		      con.screen_alternated = (c == 'h');
-		      need_fix_tab_position = true;
+		      need_fix_tab_position = wincap.has_con_broken_tabs ();
 		    }
 		  if (con.args[i] == 1) /* DECCKM */
 		    con.cursor_key_app_mode = (c == 'h');
-- 
2.35.1


                 reply	other threads:[~2022-02-20 11:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220220111636.1000-1-takashi.yano@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).