summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-05-07 20:25:35 +0200
committerBram Moolenaar <Bram@vim.org>2014-05-07 20:25:35 +0200
commit56b3bf89aa2021d20afabd8ec7b513beb1b8df25 (patch)
treea7f09a2544e11b0f13f474cca9526eefbade718f
parent1b1063af58b015b7827168f8fa2631efb60c252b (diff)
downloadvim-git-56b3bf89aa2021d20afabd8ec7b513beb1b8df25.tar.gz
updated for version 7.4.280v7.4.280
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.
-rw-r--r--src/version.c2
-rw-r--r--src/window.c18
2 files changed, 15 insertions, 5 deletions
diff --git a/src/version.c b/src/version.c
index 80c9fe3fa..818a8b5c1 100644
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 280,
+/**/
279,
/**/
278,
diff --git a/src/window.c b/src/window.c
index 02eb903fb..485f7ef04 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5623,7 +5623,7 @@ set_fraction(wp)
win_T *wp;
{
wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT
- + FRACTION_MULT / 2) / (long)wp->w_height;
+ + wp->w_height / 2) / (long)wp->w_height;
}
/*
@@ -5638,6 +5638,7 @@ win_new_height(wp, 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.
* Will equalize heights soon to fix it. */
@@ -5646,8 +5647,13 @@ win_new_height(wp, height)
if (wp->w_height == height)
return; /* nothing to do */
- if (wp->w_wrow != wp->w_prev_fraction_row && wp->w_height > 0)
- set_fraction(wp);
+ if (wp->w_height > 0)
+ {
+ 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_skipcol = 0;
@@ -5667,7 +5673,8 @@ win_new_height(wp, height)
lnum = wp->w_cursor.lnum;
if (lnum < 1) /* can happen when starting up */
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;
sline = wp->w_wrow - line_size;
@@ -5757,7 +5764,8 @@ win_new_height(wp, height)
update_topline();
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);
redraw_win_later(wp, SOME_VALID);