On Tue, Sep 6, 2022 at 8:40 AM Koichi Murase <[email protected]> wrote:
>
> The empty parameter or parameter 0 of terminal control functions
> typically mean the default.  In fact, typical implementations of
> DECSCUSR in other terminals (vte, alacritty, mintty, vte, wt, etc.)
> treat them as the default cursor shape. See also the discussions in
> the code comment of vte [1] and Issue #3293 of xterm.js [2].
>
> However, the current implementation of DECSCUSR in st always treats
> them as parameter 1 (blinking block cursor) regardless of the user
> setting of the default cursor shape (i.e., the variable "cursorshape"
> in config.h).  This implementation causes an actual problem: there is
> no way to reset the cursor shape to the default after a terminal
> application changes the cursor shape by DECSCUSR.
>
> This commit fixes the behavior to reset the cursor shape to the
> default instead of hardcoded "blinking block cursor" (which was merely
> the initial default of VT but is not even the initial default of
> st---"steady block").
>
> [1] https://github.com/GNOME/vte/blob/fb604fe2/src/vteinternal.hh#L173-L184
> [2] https://github.com/xtermjs/xterm.js/issues/3293
> ---
>  x.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/x.c b/x.c
> index 2a3bd38..aecc6f1 100644
> --- a/x.c
> +++ b/x.c
> @@ -1739,6 +1739,8 @@ xsetcursor(int cursor)
>  {
>         if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */
>                 return 1;
> +       if (cursor == 0)
> +               cursor = cursorshape; /* 0: reset to the default */
>         win.cursor = cursor;
>         return 0;
>  }
> --
> 2.37.2
>
>

FWIW, xterm treats 0 the same as 1.
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81

Reply via email to