Skip to content

Keep cursor position on screen when opening/closing lists#2632

Merged
w0rp merged 10 commits into
dense-analysis:masterfrom
suoto:master
Aug 17, 2019
Merged

Keep cursor position on screen when opening/closing lists#2632
w0rp merged 10 commits into
dense-analysis:masterfrom
suoto:master

Conversation

@suoto
Copy link
Copy Markdown
Contributor

@suoto suoto commented Jul 6, 2019

Fixes #2623

Since linter's results are published asynchronously, both location and quickfix lists can open or close during an edit. As of now, the cursor line will move around a bit to accommodate that, which makes very difficult to continue typing, especially if there's multiple linters with varying execution times running (window will bounce in and out quicker).

This PR should wrap opening and closing both location and quickfix lists with winsaveview() before and winrestview() after, restoring the topmost line, so that the line currently being edited doesn't jump around the screen.

Copy link
Copy Markdown
Member

@w0rp w0rp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good idea. I think this can just be on always when opening and closing windows.

Comment thread autoload/ale/list.vim Outdated
Comment thread autoload/ale/list.vim Outdated
@w0rp w0rp merged commit 219fb58 into dense-analysis:master Aug 17, 2019
@w0rp
Copy link
Copy Markdown
Member

w0rp commented Aug 17, 2019

Sorry for the delay.

Cheers! 🍻

suoto added a commit to suoto/ale that referenced this pull request Sep 11, 2019
…lysis#2632)

* Trying to keep win view from bouncing
* Adjusting when views are saved and restored
* Also restore view when closing quickfix
* Don't restore view when opening list vertically
timlag1305 pushed a commit to timlag1305/ale that referenced this pull request Nov 5, 2019
…lysis#2632)

* Trying to keep win view from bouncing
* Adjusting when views are saved and restored
* Also restore view when closing quickfix
* Don't restore view when opening list vertically
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.

Cursor position on screen moves when lists are opened or closed

2 participants