This is the mail archive of the cygwin-patches 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] Cygwin: console: Change timing of set/unset xterm compatible mode.


Hi Takashi,

On Feb 16 17:13, Takashi Yano wrote:
> - If two cygwin programs are executed simultaneousley with pipes
>   in cmd.exe, xterm compatible mode is accidentally disabled by
>   the process which ends first. After that, escape sequences are
>   not handled correctly in the other app. This is the problem 2
>   reported in https://cygwin.com/ml/cygwin/2020-02/msg00116.html.
>   This patch fixes the issue. This patch also fixes the problem 3.
>   For these issues, the timing of setting and unsetting xterm
>   compatible mode is changed. For read, xterm compatible mode is
>   enabled only within read() or select() functions. For write, it
>   is enabled every time write() is called, and restored on close().

Oh well, I was just going to release 3.1.3 :}

In terms of this patch, rather than to change the mode on every
invocation of read/write/select/close, wouldn't it make more sense to
count the number of mode switches in a shared per-console variable, i.e.

LONG shared_console_info::xterms_mode = 0;

on open:

  if (InterlockedIncrement (&xterm_mode) == 1)
    switch to xterm mode;

on close:

  if (InterlockedDecrement (&xterm_mode)) == 0)
    switch back to compat mode;

?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

Attachment: signature.asc
Description: PGP signature


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