-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scroll speedup #629
Scroll speedup #629
Conversation
d659a9c
to
a0b403e
Compare
If I watch the line numbers on the left, I can see the changes of speed as I slowly move the cursor further out of the window, and the debug messages seem to confirm that. |
I hit a couple of problems almost certainly unrelated to this PR:
|
778999d
to
b23caab
Compare
I did something similar to this, but also capped the values. No faster than 50ms, no slower than 500ms. |
I couldn't reproduce this. The
I wasn't able to reproduce this. Maybe platform dependent? |
It is, but inside an |
The last part of my point 1 is caused by the fact that when you start clicking and dragging, then LATER press the Alt key to switch it to column-mode, the method Not sure of the best way to re-organize. Essentially, we can't rely on Alt-click, because if you click then Alt, you don't get an Alt-click, hence the section in
Adding
into that section does seem to fix the bug, but does involve duplicating a couple lines of code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from commented out old code and debug print of course - all looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still very choppy on macOS for me -- the selection happens, but doesn't actually show on the screen unless I twitch the selection cursor, until I let up at end of selection. It's the same for both column select and default select. I don't know if that's fixable, but it's not a reason to hold up on the PR.
I agree, but I can't see a way to fix it. While I can control how often the scroll routine is called (to speed up as you move further outside the window), I'm already scrolling the minimum distance of 1 unit, and scrolling more than that in one step would surely make it choppier? I'm not sure Tk can do it more elegantly than this, or in any case I have no ideas how to improve it. We could keep tinkering with the speed of the callback running... |
When dragging to select text and crossing the view's edge, scroll slowly at first, and increasingly faster the further from the edge the mouse is moved. Impose a min/max on this speed to not get out of control (and not scroll too slowly either).
aaffff4
to
efbabcf
Compare
Hm, wasn't thinking when I re-requested review. You both approved already. Rebased, squashed, tidied up debug prints, made CI happy... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for formality's sake.
For what it's worth, I figured that we were stuck with the choppiness (or at least that I was), I just wanted to mention it in case there was something obvious that might make it smoother. 🤷♀️
I've played with |
Adjust scrolling speed during a drag-select operation based on how far outside the window we've moved.
For column-select mode, this affects all platforms. For linear select mode, it's only relevant on Mac.
Initial attempt:
Edited to add:
This PoC will print debug info on output showing the current scroll speed (in ms) and how many pixels beyond the boundary the cursor is. Example output below (trimmed for brevity; the real output streams by quickly):
Aside from making sure scrolling continues to work properly, I'm soliciting feedback on the speed and how it ought to be adjusted.