* [PATCH] Cygwin: pty: Fix screen distortion after less for native apps again.
@ 2020-06-02 12:44 Takashi Yano
2020-06-03 7:01 ` Takashi Yano
0 siblings, 1 reply; 2+ messages in thread
From: Takashi Yano @ 2020-06-02 12:44 UTC (permalink / raw)
To: cygwin-patches
- Commit c4b060e3fe3bed05b3a69ccbcc20993ad85e163d seems to be not
enough. Fixed again.
---
winsup/cygwin/fhandler_tty.cc | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index bcc7648f3..742fa7e33 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -1394,10 +1394,6 @@ fhandler_pty_slave::push_to_pcon_screenbuffer (const char *ptr, size_t len,
nlen = p0 - buf;
}
}
- if (!nlen) /* Nothing to be synchronized */
- goto cleanup;
- if (get_ttyp ()->switch_to_pcon_out && !is_echo)
- goto cleanup;
/* Remove ESC sequence which returns results to console
input buffer. Without this, cursor position report
is put into the input buffer as a garbage. */
@@ -1413,6 +1409,10 @@ fhandler_pty_slave::push_to_pcon_screenbuffer (const char *ptr, size_t len,
memmove (p0, p0+4, nlen - (p0+4 - buf));
nlen -= 4;
}
+ if (!nlen) /* Nothing to be synchronized */
+ goto cleanup;
+ if (get_ttyp ()->switch_to_pcon_out && !is_echo)
+ goto cleanup;
/* If the ESC sequence ESC[?3h or ESC[?3l which clears console screen
buffer is pushed, set need_redraw_screen to trigger redraw screen. */
@@ -1504,6 +1504,15 @@ fhandler_pty_slave::write (const void *ptr, size_t len)
reset_switch_to_pcon ();
+ bool screen_alternated_orig = get_ttyp ()->screen_alternated;
+ /* Push slave output to pseudo console screen buffer */
+ if (get_pseudo_console () && !screen_alternated_orig)
+ {
+ acquire_output_mutex (INFINITE);
+ push_to_pcon_screenbuffer ((char *)ptr, len, false);
+ release_output_mutex ();
+ }
+
bool output_to_pcon =
get_ttyp ()->switch_to_pcon_out && !get_ttyp ()->screen_alternated;
@@ -1564,7 +1573,7 @@ fhandler_pty_slave::write (const void *ptr, size_t len)
restore_reattach_pcon ();
/* Push slave output to pseudo console screen buffer */
- if (get_pseudo_console ())
+ if (get_pseudo_console () && screen_alternated_orig)
{
acquire_output_mutex (INFINITE);
push_to_pcon_screenbuffer ((char *)ptr, len, false);
--
2.26.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Cygwin: pty: Fix screen distortion after less for native apps again.
2020-06-02 12:44 [PATCH] Cygwin: pty: Fix screen distortion after less for native apps again Takashi Yano
@ 2020-06-03 7:01 ` Takashi Yano
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Yano @ 2020-06-03 7:01 UTC (permalink / raw)
To: cygwin-patches
On Tue, 2 Jun 2020 21:44:40 +0900
Takashi Yano wrote:
> - Commit c4b060e3fe3bed05b3a69ccbcc20993ad85e163d seems to be not
> enough. Fixed again.
This patch does not work as expected in Win10 1809.
I will submit v2 patch which is more essential shortly.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-03 7:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 12:44 [PATCH] Cygwin: pty: Fix screen distortion after less for native apps again Takashi Yano
2020-06-03 7:01 ` Takashi Yano
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).