On Tue, Sep 06, 2022 at 09:40:21PM +0900, Koichi Murase 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 > >
Hi, Are you sure it is correct? The page https://invisible-island.net/xterm/ctlseqs/ctlseqs.html describes: CSI Ps SP q Set cursor style (DECSCUSR), VT520. Ps = 0 blinking block. Ps = 1 blinking block (default). Ps = 2 steady block. Ps = 3 blinking underline. Ps = 4 steady underline. Ps = 5 blinking bar, xterm. Ps = 6 steady bar, xterm. To reproduce: xterm -uc # underline cursor printf '\x1b[0; q' # shows blinking block cursor -- Kind regards, Hiltjo