aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/diff.c
diff options
context:
space:
mode:
authorlonerover <pathfinder1644@yahoo.com>2017-02-07 15:48:01 +0800
committerlonerover <pathfinder1644@yahoo.com>2017-02-09 08:24:43 +0800
commit67eae935575b85719f3292d428d9d5387e0d7fb8 (patch)
tree492e21afe1324f6c3ba65991b4f338d573043373 /src/nvim/diff.c
parent7629176fb11be234882c64e3bf92d97839301fe4 (diff)
downloadrneovim-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/diff.c')
-rw-r--r--src/nvim/diff.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 9cb0789400..5940dc55da 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1007,6 +1007,10 @@ void ex_diffsplit(exarg_T *eap)
bufref_T old_curbuf;
set_bufref(&old_curbuf, curbuf);
+ // 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;
@@ -1032,6 +1036,9 @@ void ex_diffsplit(exarg_T *eap)
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);
}
}
}