Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
10012:7fd537428bcd | 10013:942d40a92be6 |
---|---|
1073 | 1073 |
1074 set_bufref(&old_curbuf, curbuf); | 1074 set_bufref(&old_curbuf, curbuf); |
1075 #ifdef FEAT_GUI | 1075 #ifdef FEAT_GUI |
1076 need_mouse_correct = TRUE; | 1076 need_mouse_correct = TRUE; |
1077 #endif | 1077 #endif |
1078 /* Need to compute w_fraction when no redraw happened yet. */ | |
1079 validate_cursor(); | |
1080 set_fraction(curwin); | |
1081 | |
1078 /* don't use a new tab page, each tab page has its own diffs */ | 1082 /* don't use a new tab page, each tab page has its own diffs */ |
1079 cmdmod.tab = 0; | 1083 cmdmod.tab = 0; |
1080 | 1084 |
1081 if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL) | 1085 if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL) |
1082 { | 1086 { |
1099 old_curbuf.br_buf, | 1103 old_curbuf.br_buf, |
1100 old_curwin->w_cursor.lnum, | 1104 old_curwin->w_cursor.lnum, |
1101 curbuf, | 1105 curbuf, |
1102 curwin->w_cursor.lnum); | 1106 curwin->w_cursor.lnum); |
1103 } | 1107 } |
1108 /* Now that lines are folded scroll to show the cursor at the same | |
1109 * relative position. */ | |
1110 scroll_to_fraction(curwin, curwin->w_height); | |
1104 } | 1111 } |
1105 } | 1112 } |
1106 } | 1113 } |
1107 | 1114 |
1108 /* | 1115 /* |