mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 06:58:35 +00:00
Merge pull request #6076 from lonerover/vim-7.4.2275
vim-patch: 7.4.2275,7.4.2279
This commit is contained in:
@@ -1007,6 +1007,10 @@ void ex_diffsplit(exarg_T *eap)
|
|||||||
bufref_T old_curbuf;
|
bufref_T old_curbuf;
|
||||||
set_bufref(&old_curbuf, 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
|
// don't use a new tab page, each tab page has its own diffs
|
||||||
cmdmod.tab = 0;
|
cmdmod.tab = 0;
|
||||||
|
|
||||||
@@ -1032,6 +1036,9 @@ void ex_diffsplit(exarg_T *eap)
|
|||||||
curwin->w_cursor.lnum);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1154,10 +1161,13 @@ void ex_diffoff(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
foldUpdateAll(wp);
|
foldUpdateAll(wp);
|
||||||
|
|
||||||
// make sure topline is not halfway through a fold
|
|
||||||
changed_window_setting_win(wp);
|
|
||||||
}
|
}
|
||||||
|
// remove filler lines
|
||||||
|
wp->w_topfill = 0;
|
||||||
|
|
||||||
|
// make sure topline is not halfway a fold and cursor is
|
||||||
|
// invalidated
|
||||||
|
changed_window_setting_win(wp);
|
||||||
|
|
||||||
// Note: 'sbo' is not restored, it's a global option.
|
// Note: 'sbo' is not restored, it's a global option.
|
||||||
diff_buf_adjust(wp);
|
diff_buf_adjust(wp);
|
||||||
|
@@ -202,3 +202,19 @@ func Test_diffget_diffput()
|
|||||||
bwipe!
|
bwipe!
|
||||||
enew!
|
enew!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_diffoff()
|
||||||
|
enew!
|
||||||
|
call setline(1, ['Two', 'Three'])
|
||||||
|
let normattr = screenattr(1, 1)
|
||||||
|
diffthis
|
||||||
|
botright vert new
|
||||||
|
call setline(1, ['One', '', 'Two', 'Three'])
|
||||||
|
diffthis
|
||||||
|
redraw
|
||||||
|
diffoff!
|
||||||
|
redraw
|
||||||
|
call assert_equal(normattr, screenattr(1, 1))
|
||||||
|
bwipe!
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
@@ -161,11 +161,11 @@ static int included_patches[] = {
|
|||||||
// 2282 NA
|
// 2282 NA
|
||||||
// 2281 NA
|
// 2281 NA
|
||||||
// 2280,
|
// 2280,
|
||||||
// 2279,
|
2279,
|
||||||
// 2278 NA
|
// 2278 NA
|
||||||
2277,
|
2277,
|
||||||
// 2276,
|
// 2276,
|
||||||
// 2275,
|
2275,
|
||||||
2274,
|
2274,
|
||||||
2273,
|
2273,
|
||||||
2272,
|
2272,
|
||||||
|
@@ -4717,8 +4717,6 @@ void set_fraction(win_T *wp)
|
|||||||
*/
|
*/
|
||||||
void win_new_height(win_T *wp, int height)
|
void win_new_height(win_T *wp, int height)
|
||||||
{
|
{
|
||||||
linenr_T lnum;
|
|
||||||
int sline, line_size;
|
|
||||||
int prev_height = wp->w_height;
|
int prev_height = wp->w_height;
|
||||||
|
|
||||||
/* Don't want a negative height. Happens when splitting a tiny window.
|
/* 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_height = height;
|
||||||
wp->w_skipcol = 0;
|
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
|
/* 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. */
|
* 'scrollbind' is set and this isn't the current window. */
|
||||||
if (height > 0
|
if (height > 0
|
||||||
|
Reference in New Issue
Block a user