diff options
author | lonerover <pathfinder1644@yahoo.com> | 2017-02-07 15:48:01 +0800 |
---|---|---|
committer | lonerover <pathfinder1644@yahoo.com> | 2017-02-09 08:24:43 +0800 |
commit | 67eae935575b85719f3292d428d9d5387e0d7fb8 (patch) | |
tree | 492e21afe1324f6c3ba65991b4f338d573043373 /src/nvim/window.c | |
parent | 7629176fb11be234882c64e3bf92d97839301fe4 (diff) | |
download | rneovim-67eae935575b85719f3292d428d9d5387e0d7fb8.tar.gz rneovim-67eae935575b85719f3292d428d9d5387e0d7fb8.tar.bz2 rneovim-67eae935575b85719f3292d428d9d5387e0d7fb8.zip |
vim-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.
https://github.com/vim/vim/commit/46328f9a1cc8047d1e05095bc9f531038c5a4028
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r-- | src/nvim/window.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 510f182353..28269e8889 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -4717,8 +4717,6 @@ void set_fraction(win_T *wp) */ void win_new_height(win_T *wp, int height) { - linenr_T lnum; - int sline, line_size; int prev_height = wp->w_height; /* Don't want a negative height. Happens when splitting a tiny window. @@ -4745,6 +4743,15 @@ void win_new_height(win_T *wp, int height) wp->w_height = height; wp->w_skipcol = 0; + scroll_to_fraction(wp, prev_height); +} + +void scroll_to_fraction(win_T *wp, int prev_height) +{ + linenr_T lnum; + int sline, line_size; + int height = wp->w_height; + /* Don't change w_topline when height is zero. Don't set w_topline when * 'scrollbind' is set and this isn't the current window. */ if (height > 0 |