Bug 425707

Summary: Unexpected Konsole mouse cursor position change when changing cursor shape
Product: [Applications] konsole Reporter: oldherl <oldherl>
Component: emulationAssignee: Konsole Developer <konsole-devel>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: 20.04.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Video clip showing the bug, konsole 20.04.3 on Arch Linux
No bug on my modified konsole.

Description oldherl 2020-08-23 12:00:33 UTC
Created attachment 131123 [details]
Video clip showing the bug, konsole 20.04.3 on Arch Linux

SUMMARY
In Konsole, when changing from mouse-tracking application (e.g. mouse-enabled tmux or vim) to default (e.g. exiting tmux), the mouse cursor moves unexpectedly. 

STEPS TO REPRODUCE
1. Open a Konsole window and run a mouse-enabled tmux in it.
2. Type "exit" but no Enter key
3. Move the mouse cursor to the end of PS1
4. Press Enter to exit tmux.

OBSERVED RESULT

Unexpected mouse position change. The cursor is not in the same place as before the Enter key. In my video it jumps up for almost one character height.

See the video clip "konsolebug".

EXPECTED RESULT

Only the shape would change from Arrow (application mouse tracking mode) to I-Beam (default), but the position should not change.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 20.04.3
KDE Frameworks Version: 5.72.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION

I can reproduce it on git `master` branch of konsole and the same version for all other libraries.
I cloned the konsole source code from git and did a bit of debugging. Seems that it's caused by `KCursor::setAutoHideCursor`. I removed that line so that the cursor won't auto-hide on key strokes, and the bug disappears. Hope that helps.
I recorded in "konsolenobug" video.
Comment 1 oldherl 2020-08-23 12:03:38 UTC
Created attachment 131124 [details]
No bug on my modified konsole.

Uploaded a video with my modified konsole. Bug disappears. 
I removed line 549 of TerminalDisplay.cpp,
`KCursor::setAutoHideCursor(this, true);`

Sorry for the hand-held phone videos. The bug won't appear in screenshots because the recording software would "fix" the bug!