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

VIM-2773: Prevent viewport displacement on undo #603

Merged

Conversation

dominicpalmer
Copy link
Contributor

@dominicpalmer dominicpalmer commented Feb 25, 2023

Small bug fix for VIM-2773 which I raised on YouTrack.

Fixes viewport displacement when undoing deletion of lines or blocks that are immediately followed by a space character.

Before:

before_scrollback

After:

after_scrollback

@AlexPl292
Copy link
Member

This looks good for me. @citizenmatt Could you please also take a look, I know you like scrolling?

@citizenmatt
Copy link
Member

LGTM. I'd like to understand why it's necessary, to see if we're doing something wrong, or if it's a quirk of IntelliJ's undo system. More importantly, I'd like to know if it's something we should be guarding against elsewhere, but I can look into that separately.

(It appears to be related to caret positioning. The behaviour shows if the caret is moved to a column when it's moved away from the deleted line. If we :set nostartofline, so the caret column is maintained, and the caret column on the deleted line was 0, then we don't see the scrolling behaviour. If the caret is moved to any other column, then we see scrolling on undo)

@citizenmatt
Copy link
Member

Hmm. I've just seen the same behaviour if you use Ctrl+z to undo a dd operation, so we should probably look deeper into what's going on here. I think this is still a worthwhile change, though.

@AlexPl292 AlexPl292 merged commit dd69d0f into JetBrains:master Mar 1, 2023
@citizenmatt
Copy link
Member

Oh, and forgot to say thanks @dominicpalmer! Nice work 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants