-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support scrolloff with mouse actions #611
Conversation
I think it's quite hacky since it doesn't always scroll unless you jiggle your mouse. I need to move my mouse left and right or up and down for this to work in konsole. |
No problem in GNOME Terminal. Could you record an asciinema or screencast? Code doesn't look hacky: we need to move view according to cursor position and do that. I hope I understood that fn correctly Edit: but I need the same stuff in WezTerm. Move mouse up&down |
@@ -815,6 +820,7 @@ impl EditorView { | |||
.. | |||
} => { | |||
let (view, doc) = current!(cxt.editor); | |||
view.ensure_cursor_in_view(doc, cxt.editor.config.scrolloff); |
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.
this might need to be sorta recursive: even if cursor stays in place, scroll unless cursor is moved away from scrolloff area
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.
Btw that bug is caused by the following behavior difference:
- VTE sends drag events on one-pixel movements that are frequent when holding mouse, even though mouse doesn't move to different character place in terminal
- Konsole and WezTerm, on the other hand, send drag events only when mouse moves from one character place to another
If we're going to support this, then I think we'll want something that tracks the last reported location of the mouse, so if the mouse is still held down we can keep scrolling as appropriate. Having said that, this makes me wonder what kind of corner-cases we'll run into. If the mouse leaves the window, does it report a mouse-up event? How consistent is that between terminal emulators? Etc. I definitely like the feature, though. But let's make sure we cover our bases to get a consistent experience across terminals, to the extent that's reasonably possible. |
@sh7dm Can you please help to try it out in konsole? |
I don't really know how to (where exactly) loop that action. Maybe spawn a new tokio thread? |
I just noticed that this has already been addressed with #5255 |
Now clicking will ensure cursor is not on bound of screen and when you drag near the bound of screen view will scroll keeping your selection.
Related: is https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs#L926 really required? (maybe should be optional). It would be great to select and not lose selection when scrolling.