mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-08 18:19:08 +08:00
Cygwin: pty: Disable ResizePseudoConsole() if stdout is redirected.
- Calling ResizePseudoConsole() generates some escape sequences. Due to this behaviour, if the output of non-cygwin app is piped to less, screen is sometimes distorted when the screen is resized. With this patch, ResizePseudoConsole() is not called if stdout is redirected.
This commit is contained in:
parent
f685416883
commit
c5bf5617c0
@ -1511,7 +1511,7 @@ fhandler_pty_common::resize_pseudo_console (struct winsize *ws)
|
||||
size.X = ws->ws_col;
|
||||
size.Y = ws->ws_row;
|
||||
pinfo p (get_ttyp ()->pcon_pid);
|
||||
if (p)
|
||||
if (p && !get_ttyp ()->do_not_resize_pcon)
|
||||
{
|
||||
HPCON_INTERNAL hpcon_local;
|
||||
HANDLE pcon_owner =
|
||||
@ -2489,7 +2489,10 @@ fhandler_pty_slave::setup_pseudoconsole (STARTUPINFOEXW *si, bool nopcon)
|
||||
si->StartupInfo.hStdInput = fh0->get_handle ();
|
||||
fhandler_base *fh1 = ::cygheap->fdtab[1];
|
||||
if (fh1 && fh1->get_device () != get_device ())
|
||||
si->StartupInfo.hStdOutput = fh1->get_output_handle ();
|
||||
{
|
||||
get_ttyp ()->do_not_resize_pcon = true;
|
||||
si->StartupInfo.hStdOutput = fh1->get_output_handle ();
|
||||
}
|
||||
fhandler_base *fh2 = ::cygheap->fdtab[2];
|
||||
if (fh2 && fh2->get_device () != get_device ())
|
||||
si->StartupInfo.hStdError = fh2->get_output_handle ();
|
||||
@ -2535,6 +2538,7 @@ fhandler_pty_slave::close_pseudoconsole (void)
|
||||
get_ttyp ()->switch_to_pcon_in = false;
|
||||
get_ttyp ()->pcon_pid = 0;
|
||||
get_ttyp ()->pcon_start = false;
|
||||
get_ttyp ()->do_not_resize_pcon = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,6 +245,7 @@ tty::init ()
|
||||
pcon_cap_checked = false;
|
||||
has_csi6n = false;
|
||||
has_set_title = false;
|
||||
do_not_resize_pcon = false;
|
||||
}
|
||||
|
||||
HANDLE
|
||||
|
@ -104,6 +104,7 @@ private:
|
||||
bool pcon_cap_checked;
|
||||
bool has_csi6n;
|
||||
bool has_set_title;
|
||||
bool do_not_resize_pcon;
|
||||
|
||||
public:
|
||||
HANDLE from_master () const { return _from_master; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user