diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-28 15:39:57 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-28 15:39:57 +0200 |
commit | 46328f9a1cc8047d1e05095bc9f531038c5a4028 (patch) | |
tree | 6c304ad0ec0fdaafa7e4e490681a959f36ad46f2 /src/window.c | |
parent | 4427db9bb2f4b4587559eac18cc7ba10c52c6e8b (diff) | |
download | vim-46328f9a1cc8047d1e05095bc9f531038c5a4028.zip |
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.
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/window.c b/src/window.c index 65d8b36ea..6943c8fe3 100644 --- a/src/window.c +++ b/src/window.c @@ -5674,8 +5674,6 @@ 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. @@ -5701,6 +5699,16 @@ 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 |