Mercurial > vim
diff src/diff.c @ 10013:942d40a92be6 v7.4.2279
commit https://github.com/vim/vim/commit/46328f9a1cc8047d1e05095bc9f531038c5a4028
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 28 15:39:57 2016 +0200
patch 7.4.2279
Problem: Starting diff mode with the cursor in the last line might end up
only showing one closed fold. (John Beckett)
Solution: Scroll the window to show the same relative cursor position.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 28 Aug 2016 15:45:05 +0200 |
parents | 4b4ba6589a98 |
children | 4aead6a9b7a9 |
line wrap: on
line diff
--- a/src/diff.c +++ b/src/diff.c @@ -1075,6 +1075,10 @@ ex_diffsplit(exarg_T *eap) #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif + /* Need to compute w_fraction when no redraw happened yet. */ + validate_cursor(); + set_fraction(curwin); + /* don't use a new tab page, each tab page has its own diffs */ cmdmod.tab = 0; @@ -1101,6 +1105,9 @@ ex_diffsplit(exarg_T *eap) curbuf, curwin->w_cursor.lnum); } + /* Now that lines are folded scroll to show the cursor at the same + * relative position. */ + scroll_to_fraction(curwin, curwin->w_height); } } }