Bug 454312

Summary: Kate Vi mode mouse selection makes cursor position wrong (always +1 column)
Product: [Applications] kate Reporter: red_Arti <jijiliu35>
Component: Vi Input ModeAssignee: KWrite Developers <kwrite-bugs-null>
Status: REPORTED ---    
Severity: normal CC: nck
Priority: NOR    
Version: 22.04.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: screenshot

Description red_Arti 2022-05-24 06:23:08 UTC
Created attachment 149157 [details]
screenshot

SUMMARY

If you have text:
`123456789`
and you want to select 3 to 7 (vi visual mode) and operate (delete/cut/copy/replace)
The "block cursor" is at 7, making it looks like the selection range is 3 to 7
But the true selection range is 3 to 6
That's different than Vim's behavior, making user can't see the real selection range


STEPS TO REPRODUCE
1. Run Kate. Open a text file
2. Set Kate into Vi input mode 
3. Use mouse to select text (it will enter visual mode)
4. Move mouse and select text from left to right, or from up to down

OBSERVED RESULT
The wrong positioned cursor (selection end position + 1 column)  makes user can't see the range correctly.

EXPECTED RESULT
The cursor should be at the last selected character block position, like Vim (see the screenshot)

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.2
Graphics Platform: X11

ADDITIONAL INFORMATION

Such wrong positioned cursor won't occur when:
1. Make selection by h, l (left, right) keyboard
2. Select text from right to left, or from down to up
Comment 1 Sarah Wong 2022-10-18 20:25:07 UTC
Attempting a fix here:
https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/430