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

Cursor jumps to top of file during formatting #65

Closed
ronakg opened this issue Jun 3, 2017 · 9 comments
Closed

Cursor jumps to top of file during formatting #65

ronakg opened this issue Jun 3, 2017 · 9 comments
Labels

Comments

@ronakg
Copy link

ronakg commented Jun 3, 2017

When I run :ClangFormat the cursor jumps to top of the file and then jumps back down to where it was before. In this process the current visible buffer gets adjusted because the jump back puts the cursor in the middle of the visible area.

Is it possible to avoid this jump at all?

@expipiplus1
Copy link
Contributor

Seems similar to nbouscal/vim-stylish-haskell#7

@jmnel
Copy link

jmnel commented Jun 27, 2017

I just started experiencing the same bug after a recent NeoVim update on Arch Linux. The application scrolls up until one line above the current cursor line, when running :ClangFormat. The problem is also triggered by undo.

Does anyone have any advice to start debugging this issue?

@rhysd
Copy link
Owner

rhysd commented Jun 28, 2017

I'm trying to reproduce this with the latest Neovim.

@rhysd rhysd added the bug label Jun 28, 2017
@rhysd
Copy link
Owner

rhysd commented Jun 28, 2017

I think we need to restore screen position in addition to cursor position.

rhysd added a commit that referenced this issue Jun 28, 2017
@rhysd
Copy link
Owner

rhysd commented Jun 28, 2017

@ronakg @expipiplus1 @jmnel f759745 would fix this issue. Please try the latest.

@jmnel
Copy link

jmnel commented Jun 29, 2017

Thank you for the fast response. The cursor and screen no longer jump from :ClangFormat after f759745. I am still observing jumping with undo, but this is possibly a seperate neovim issue introduced by the recent update. I will try to isolate the issue by turning off plugins.

@rhysd
Copy link
Owner

rhysd commented Jun 29, 2017

Yes, cursor jumps on undo. But currently the behavior is not avoidable because vim-clang-format replaces entire buffer.

@rhysd
Copy link
Owner

rhysd commented Jun 30, 2017

Because cursor moving on undo is the known issue and tracked in #8, let me close this issue. If you find another problem related to this issue, please let me know by commenting here or creating a new issue. Thank you for your report and cooperation.

@rhysd rhysd closed this as completed Jun 30, 2017
@jmnel
Copy link

jmnel commented Jul 16, 2017

For a temporary solution, please see my comment in #8.

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

No branches or pull requests

4 participants