On Dec 19 22:17, Takashi Yano wrote:
> Currently, there are four separate workarounds for pseudo console
> output in pty_master_fwd_thread. Each workaround has its own 'for'
> loop that iterates over the entire output buffer, which is not
> efficient. This patch consolidates these loops and introduces a
> single state machine to handle all workarounds at once. In addition,
> the workarounds are moved into a dedicated function,
> 'workarounds_for_pseudo_console_output()' to improve readability.
>
> Suggested-by: Johannes Schindelin <[email protected]>
> Reviewed-by: Johannes Schindelin <[email protected]>, Corinna
> Vinschen <[email protected]>
> Signed-off-by: Takashi Yano <[email protected]>
> ---
> winsup/cygwin/fhandler/pty.cc | 301 +++++++++++++++++-----------------
> 1 file changed, 147 insertions(+), 154 deletions(-)
There's just one typo missing, but you don't have to send a new version for
that:
> + /* Workaround for rlwrap in Win11. rlwrap treats text between
> + NLs as a line, however, pseudo console in Win11 somtimes
sometimes
> +#define CSIH_INSERT "\033[H\r\n"
> +#define CSIH_INSLEN (sizeof (CSIH_INSERT) - 1)
> +[...]
> +#define CONSOLE_HELPER "\\bin\\cygwin-console-helper.exe"
> +#define CONSOLE_HELPER_LEN (sizeof (CONSOLE_HELPER) - 1)
My personal preference would be to define these macros prior to the
function, but that's a style question I'm not sure we should enforce.
Whatever makes more sense to you.
Other than those, LGTM. In terms of the macros, no new version required,
just go ahead, whether you move them or not.
Thanks,
Corinna