Bug 513898 - view.setVirtualCursorPosition: wrong behavior when line contains tabs
Summary: view.setVirtualCursorPosition: wrong behavior when line contains tabs
Status: REPORTED
Alias: None
Product: kate
Classification: Applications
Component: scripting (other bugs)
Version First Reported In: 25.12.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-12-27 23:40 UTC by Grósz Dániel
Modified: 2026-01-01 21:58 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grósz Dániel 2025-12-27 23:40:15 UTC
SUMMARY
view.setVirtualCursorPosition() puts the cursor in the wrong position if the line contains tabs.

It seems like it attemps to compensate for that tabs should count as more than one character for this purpose, .but it adds the compensation instead of subtracting it.

The counterpart view.virtualCursorPosition() seems to work fine.

STEPS TO REPRODUCE
1. Set Indentation mode to Tabs. Set tab width to 4.
2. Enter this in the first line of a document:
<TAB>123456789
3. Invoke a script that contains this code:
view.setVirtualCursorPosition(0,4)

OBSERVED RESULT
The cursor is just before the 7.

EXPECTED RESULT
The cursor is just before the 1.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20251225
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1
Kernel Version: 6.18.2-1-default (64-bit)
Graphics Platform: X11
Comment 1 Christoph Cullmann 2026-01-01 21:58:34 UTC
Sounds not correct on first glance, if you have interest to patch that, that is welcome.