This patch implements the jump to clicked position in "show-minimap" mode for the scrollbar.
Details
- Reviewers
dhaumann kfunk - Group Reviewers
KTextEditor Kate - Commits
- R39:7bb1f434afaf: Jump to the clicked scrollbar position when minim-map is enabled.
Diff Detail
- Repository
- R39 KTextEditor
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Shouldn't left click scroll up and down a bit with middle click jumping to position - that's the behavior of Qt's scroll bars.
Reasoning behind the change of behavior:
- With mini-map it is seems a bit more logical to jump to the clicked place in stead of "searching your way there". (You already know where you want to go).
- Page Up/Down and mouse scroll can still be used.
- The middle click action is not very well known.
- On Windows middle-click does nothing.
- At least VisualStudio and Sublime does it like this.
There are a couple of problems with the new behavior -- though I can't tell precisely when they're caused. And not sure they're new or not either.
Things I'm seeing while mini map is enabled, only in some documents though:
- When the slider is position at the bottom: clicking repeatedly on the same position causes flickering in the view port of the editor
- Sometimes the scroll bar preview is shown while dragging the slider -- we should probably disable it while dragging altogether
- Sometimes the slider is 'jumpy', when e.g. moving the slider from bottom to top. The jump distance is the size of the "slider" height.
- Sometimes just fails to drag completely, or stops moving the slider in the middle of the drag move.
Might wanna have another look?
Hi, I'm sorry I am a bit late to the game: I once also tried to implement this, but the result was a messy patch that did not always get the location right. So I would not be surprised if there are corner cases that do not work.
In any case, either we stabilize this until the next tag (afaik, the last tag was 5 days ago?), or we need to revert.
But also: Cool that you are working on this!
I think I fixed it.
The comment about the dragging was only partially correct. The press must be inside the slider for dragging, so when the initial press is outside or not translated from the mini-map coordinates, the dragging does not start.
My solution is to first move to the desired place then forward the translated click to the QScrollBar.
Works perfectly fine for me now, great! I don't see anything wrong with it now from a behavioral point of view.
@dhaumann Maybe you want to check once more?