jreybert / vimagit

Ease your git workflow within Vim
1.31k stars 49 forks source link

View does not scroll after staging a hunk #167

Closed LiquidFire closed 6 years ago

LiquidFire commented 6 years ago

Short description of the problem

After you use S to stage a hunk, the cursor moves to the next hunk and its fold is expanded. However, in some cases that hunk was beyond the end of the screen so you can only see the top few lines of it (depending on your 'scrolloff').

It would be nice if vimagit scrolled so that the next hunk is at the top of the screen following S, in the same way it happens with C-n and C-p.

Steps to reproduce

- Open `:Magit` in vim
- Go to the first hunk with `C-n`
- Stage it with `S`
  - The cursor moves to the next hunk and expands its fold, but the view does not scroll
- Continue staging hunks with `S`
  - Eventually the next hunk is at the bottom of the screen and you can only see a little bit of the diff. To see the diff properly, you have to do e.g. `zt`.

## Environment

* `vim 8.0`

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 1 2018 14:19:51) Included patches: 1-1783


* `git 2.1.7.0`
* `vimagit` from `master` (`85c25ffc60c8d144c7867c2e4d9f09cebb510cc0`)
* Ubuntu 14.04
* terminal (Konsole 2.13.2)
jreybert commented 6 years ago

I am almost sure that this behavior is implemented in branch next (if not, it should be in some dev branch).

Feel free to test branch next and update this ticket.

LiquidFire commented 6 years ago

You are right, this is fixed by f32316dc on the next branch.

Thank you!