-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DECSCUSR() and DECSCUSR(0) should reflect the current user setting of the cursor shape #3293
Comments
Woops, this is indeed a typo in the docs 👍 |
@akinomyoga Just looked at the code - we have indeed no fixed default setting in the options for the cursor style, instead the setting gets used as initial value, but later changes overwrite that setting (with hardcoded 0|1 as BLINKING BLOCK). @Tyriar To get rid of the hardcoded default I suggest to add the cursor style to DEC private modes in |
Hey @jerch, I came from microsoft/vscode#211394 - I've looked into this a bit and would like to work on this issue. If I understand correctly, it seems that we want to add |
I'm unfamiliar with the codebase of I also think the cursor set by xterm.js/src/common/services/CoreService.ts Lines 26 to 33 in 2edc65b
I think it is natural to manage the current values of |
Record the initial cursorStyle in DEC? |
@kevinc16 Sorry for the late response. Yes you are right - we basically lack a separation of initial default state to current state, which makes it impossible to revert to the initial state since it is not preserved. @akinomyoga Yepp, To get things into perspective, we actually would need both for the full deal:
|
@Tyriar , am coming here from VSCode issue #211394 I am resuming work after a while as I was away. I am proposing that we can update the InputHandler in Xterm.js to correctly handle DECSCUSR 0 by resetting the cursor to the user's preferred style. This ensures consistency with expected terminal behavior. Would that be a good step? @Tyriar @jerch inputs will be appreciated. |
@Arup-Chauhan yep |
Signed-off-by: Arup Chauhan <[email protected]>
Hi @Tyriar , raised a draft PR to work on this, have some questions, please take a look, thanks! |
This was first reported at akinomyoga/ble.sh#95. In Visual Studio Code (VSCode), when a Bash plugin
ble.sh
is loaded in a Bash session, the cursor shape becomes alwaysBlock
regardless of the user setting of the cursor shape.This seems to be caused by the behavior of xterm.js for the control function DECSCUSR() (empty) and DECSCUSR(0) (0). I expect these parameters, empty and 0, change the cursor shape to the default one configured by the user, but, in xterm.js, empty and 0 are always treated as 1 (Blinking Block) which is just the default value for the user setting.
Behavior of other terminals
In all the other terminals that I tested (including Mintty, Alacritty, RLogin, GNOME Terminal (VTE), and Windows Terminal), when the user changed the default cursor shape from Block to another, DECSCUSR() and DECSCUSR(0) change the cursor shape to the user-configured default rather than to Block. The behavior can be checked with the following commands after the user default is changed.
I couldn't check xterm's behavior because I don't know how to change the default value for the cursor shape in xterm.
We can also find a related discussion in a code comment of VTE:
In the original DEC implementation of
DECSCUSR
, the parametersempty
and0
meant the block style, but I guess it is just because the default cursor shape of VT series couldn't be configured so was always the block style (but maybe VT allowed some user configuration, see the previous item of the VTE comment). Anyway, empty and 0 typically meant the default for some other control functions, so I believe it is a natural guess that empty and 0 for DECSCUSR are also intended for the default cursor shape.Note on ZDM
Here's a related note on the mode
ZDM
from @jerch:Fix
From the same comment by @jerch,
This is what other terminals do and I completely agree with this fix (though I think "steady block" is a typo of "blink block").
The text was updated successfully, but these errors were encountered: