mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
vim-patch:7.4.280 #745
Problem: When using a session file the relative position of the cursor is not restored if there is another tab. (Nobuhiro Takasaki) Solution: Update w_wrow before calculating the fraction. https://code.google.com/p/vim/source/detail?r=daf7e98675cf395e1ef96f8040567affb2782a11
This commit is contained in:

committed by
Justin M. Keyes

parent
862a25f96e
commit
fee0e2d977
@@ -207,7 +207,7 @@ static int included_patches[] = {
|
|||||||
//283,
|
//283,
|
||||||
//282,
|
//282,
|
||||||
//281,
|
//281,
|
||||||
//280,
|
280,
|
||||||
//279,
|
//279,
|
||||||
//278,
|
//278,
|
||||||
277,
|
277,
|
||||||
|
@@ -4457,8 +4457,8 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
|
|||||||
*/
|
*/
|
||||||
static void set_fraction(win_T *wp)
|
static void set_fraction(win_T *wp)
|
||||||
{
|
{
|
||||||
wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT
|
wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT + wp->w_height / 2)
|
||||||
+ FRACTION_MULT / 2) / (long)wp->w_height;
|
/ (long)wp->w_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -4470,6 +4470,7 @@ void win_new_height(win_T *wp, int height)
|
|||||||
{
|
{
|
||||||
linenr_T lnum;
|
linenr_T lnum;
|
||||||
int sline, line_size;
|
int sline, line_size;
|
||||||
|
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.
|
||||||
* Will equalize heights soon to fix it. */
|
* Will equalize heights soon to fix it. */
|
||||||
@@ -4478,8 +4479,14 @@ void win_new_height(win_T *wp, int height)
|
|||||||
if (wp->w_height == height)
|
if (wp->w_height == height)
|
||||||
return; /* nothing to do */
|
return; /* nothing to do */
|
||||||
|
|
||||||
if (wp->w_wrow != wp->w_prev_fraction_row && wp->w_height > 0)
|
if (wp->w_height > 0) {
|
||||||
set_fraction(wp);
|
if (wp == curwin) {
|
||||||
|
validate_cursor(); // w_wrow needs to be valid
|
||||||
|
}
|
||||||
|
if (wp->w_wrow != wp->w_prev_fraction_row) {
|
||||||
|
set_fraction(wp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wp->w_height = height;
|
wp->w_height = height;
|
||||||
wp->w_skipcol = 0;
|
wp->w_skipcol = 0;
|
||||||
@@ -4496,7 +4503,8 @@ void win_new_height(win_T *wp, int height)
|
|||||||
lnum = wp->w_cursor.lnum;
|
lnum = wp->w_cursor.lnum;
|
||||||
if (lnum < 1) /* can happen when starting up */
|
if (lnum < 1) /* can happen when starting up */
|
||||||
lnum = 1;
|
lnum = 1;
|
||||||
wp->w_wrow = ((long)wp->w_fraction * (long)height - 1L) / FRACTION_MULT;
|
wp->w_wrow = ((long)wp->w_fraction * (long)height - 1L + FRACTION_MULT / 2)
|
||||||
|
/ FRACTION_MULT;
|
||||||
line_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;
|
line_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;
|
||||||
sline = wp->w_wrow - line_size;
|
sline = wp->w_wrow - line_size;
|
||||||
|
|
||||||
@@ -4567,7 +4575,9 @@ void win_new_height(win_T *wp, int height)
|
|||||||
update_topline();
|
update_topline();
|
||||||
curs_columns(FALSE); /* validate w_wrow */
|
curs_columns(FALSE); /* validate w_wrow */
|
||||||
}
|
}
|
||||||
wp->w_prev_fraction_row = wp->w_wrow;
|
if (prev_height > 0) {
|
||||||
|
wp->w_prev_fraction_row = wp->w_wrow;
|
||||||
|
}
|
||||||
|
|
||||||
win_comp_scroll(wp);
|
win_comp_scroll(wp);
|
||||||
redraw_win_later(wp, SOME_VALID);
|
redraw_win_later(wp, SOME_VALID);
|
||||||
|
Reference in New Issue
Block a user