Bug 438225

Summary: Cursor shape is reset when using an application that changes it
Product: [Applications] konsole Reporter: Nico <nico>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED NOT A BUG    
Severity: normal CC: a.samirh78, nico, ninjalj
Priority: NOR    
Version First Reported In: 21.04.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Step 1 (change cursor shape)
Step 2 (open neovim)
Step 3 (exit neovim)

Description Nico 2021-06-07 20:07:52 UTC
SUMMARY
The Cursor shape setting is lost

STEPS TO REPRODUCE
1. Appearance -> Cursor -> Set Shape to `I-Beam` (I suppose it happens with Underline too)
2. Open a program that changes the cursor to a block (e.g. neovim)
3. Close the program

OBSERVED RESULT
The cursor for that tab no longer uses the selected shape.


EXPECTED RESULT
It should go back to the selected shape.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 5.21.90
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Nico 2021-06-07 20:08:09 UTC
Created attachment 139091 [details]
Step 1 (change cursor shape)
Comment 2 Nico 2021-06-07 20:08:25 UTC
Created attachment 139092 [details]
Step 2 (open neovim)
Comment 3 Nico 2021-06-07 20:08:48 UTC
Created attachment 139093 [details]
Step 3 (exit neovim)

https://phoenixnap.com/kb/how-to-exit-vim
Comment 4 ninjalj 2021-06-19 22:01:48 UTC
The same behavior can be observed under xterm ("xterm -uc" to start an xterm with an underline cursor) vte ("vte-2.91  --cursor-shape ibeam") and others. 

To restore the cursor to the selected shape, run "reset".
Comment 5 Nico 2021-06-19 22:05:23 UTC
Why does that mean it's not a bug? Even if you wouldn't explicitly call this a bug, this can be treated as a feature request instead, since I think that's how it should be.
Comment 6 Ahmad Samir 2021-06-19 22:08:54 UTC
IIUC, the app running in the terminal (neovim) is supposed to reset the cursor shape when it's closed (by sending an escape sequence).
Comment 7 Nico 2021-06-19 22:11:41 UTC
@Ahmad If that's the case, I can understand it. I would like another confirmation then I will create an issue for neovim.
Comment 8 Ahmad Samir 2021-06-19 22:19:07 UTC
I would try with another app, e.g. vim.
Comment 9 Nico 2021-06-19 22:20:18 UTC
It's the same problem with vim. Neovim was just an example. I can't think of another terminal program that changes the cursor shape right now.
Comment 10 ninjalj 2021-06-20 00:30:59 UTC
Neovim issue:

https://github.com/neovim/neovim/issues/4396

The most portable way to restore the cursor shape is to run "reset".

The NeoVim issue also has a link to a VimLeave handler to set the cursor to a specific shape, e.g. for a block: 

:au VimLeave * set guicursor=a:block-blinkon0

Egmont is wrong on a detail: there _is_ a way to query the cursor shape, but it seems to be only supported by xterm: DECRQSS.