This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 0/1] Pseudo console support in PTY (v2)


Hi Thomas,

On Thu, 4 Apr 2019 10:17:29 +0200 Thomas Wolff wrote:
> > (4) Call fhandler_console::need_invisible() in stdio_init() in dtable.cc
> >      instead of just returning from function when progname is "mintty".
> What's the specific handling for mintty? Puzzled, I think all pty-based 
> terminals need the same handling.

I agree.
In v1 mintty needs such tweak, however, it is not necessary any more in v2.

> > (5) Pushing slave output into pseudo console screen buffer is disabled
> >      when alternate screen buffer is used.
> Confused. What does console handling have to do with the alternate 
> screen? It's purely a client-side concept with respect to the pty. If 
> the terminal is in alternate screen mode, console output is directed to 
> that screen buffer and should be handled the same way, right?
> > (6) Change code page to 65001 (UTF-8) at startup of pty slave.
> What about other codepages, depending on the locale?
> > (7) Remove "\033[6n" and "\033[0c", which generate report result in
> >      console input buffer, in the data to be pushed into pseudo console
> >      screen buffer.
> Why's that? If a Windows console app really sends those, it will do so 
> on purpose (e.g. because it detects the %TERM% variable to conclude it's 
> running in a terminal), so it will also expect the respective response.

PTY code is very complex. PTY slave has 4 handles; two for cygwin apps,
others for native console apps. io_handle_cyg and output_handle_cyg are
for cygwin apps. io_handle and output_handle are for native console apps.
Pseudo console is attached to io_handle and output_handle. Data written
into output_handle goes through pseudo console and stored in screen
buffer and displayed. However, as for cygwin apps, data written into
output_handle_cyg does not go through pseudo console, so it is not
stored in pseudo console screen buffer. Pseudo console sometimes redraws
screen based on its own screen buffer. The data from cygwin apps is not
in pseudo console screen buffer, so it disappears. To avoid this, data
from cygwin apps is pushed into pseudo console screen buffer by pushing
it to output_handle. At the same time, to avoid displaying the data twice,
forwarding is stopped if cygwin app is active. (5) means the contents
in alternate screen buffer are not necessary to synchronize with real
terminal becuse alternate screen buffer is usually used only temporally.
As for (7), when "\033[6n" is written by cygwin apps to output_handle_cyg,
the result is returned from io_handle_cyg. If "\033[6n" is pushed into
output_handle, the results also appears in io_handle. Since this is not
read by cygwin apps, it remains in input buffer for native apps. Thus
"\033[6n" from cygwin apps should not be pushed into output_handle.
Of course "\033[6n" from native apps is not removed and written into
output_handle and result is returend from io_handle.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]