Skip to content
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

Fix(VIM-2778) Remove override of editor scroll setting #550

Merged
merged 2 commits into from
Oct 28, 2022

Conversation

citizenmatt
Copy link
Member

Previously, IdeaVim would enable the "refrain from scrolling" setting in each editor. This appears to be historical, as all IdeaVim scrolling is explicit and to an exact location. This setting now only affects the scroll location when IntelliJ navigates, such as with Go To Member when the target is already visible.

The default setting is "keep the caret in place, scroll editor canvas" (refrain from scrolling disabled - hooray for double negatives!), which will scroll the editor and place the caret about 1/3rd of the way down the editor. IdeaVim would previously override this to "move caret, minimise editor scrolling", which will move the caret without scrolling if the target is already visible.

Even though this overridden behaviour is more Vim-like (Vim prefers to move the caret if the target is visible, and scroll to centre otherwise - see gv), this setting does not affect IdeaVim navigation, and only applies to IntelliJ navigation.

This fixes VIM-2778, so the Find Usages preview window will now correctly use the setting.

This PR also replaces non-exact scrolling (scrollTo(CENTER)) in the gv handlers. The default scrollCaretIntoView behaviour is more Vim-like, and will scroll only if necessary. This removes some unnecessary code from VimEditor.

Let user decide how editor scrolls when IntelliJ performs navigation, e.g. go to file member
@AlexPl292 AlexPl292 merged commit 45908f2 into JetBrains:master Oct 28, 2022
@AlexPl292
Copy link
Member

Awesome, thank you!

@citizenmatt citizenmatt deleted the VIM-2778 branch October 30, 2022 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants