52353d6
To: vim_dev@googlegroups.com
52353d6
Subject: Patch 7.4.280
52353d6
Fcc: outbox
52353d6
From: Bram Moolenaar <Bram@moolenaar.net>
52353d6
Mime-Version: 1.0
52353d6
Content-Type: text/plain; charset=UTF-8
52353d6
Content-Transfer-Encoding: 8bit
52353d6
------------
52353d6
52353d6
Patch 7.4.280
52353d6
Problem:    When using a session file the relative position of the cursor is
52353d6
	    not restored if there is another tab. (Nobuhiro Takasaki)
52353d6
Solution:   Update w_wrow before calculating the fraction.
52353d6
Files:	    src/window.c
52353d6
52353d6
52353d6
*** ../vim-7.4.279/src/window.c	2014-03-23 15:12:29.943264337 +0100
52353d6
--- src/window.c	2014-05-07 20:18:55.237270409 +0200
52353d6
***************
52353d6
*** 5623,5629 ****
52353d6
      win_T	*wp;
52353d6
  {
52353d6
      wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT
52353d6
! 				    + FRACTION_MULT / 2) / (long)wp->w_height;
52353d6
  }
52353d6
  
52353d6
  /*
52353d6
--- 5623,5629 ----
52353d6
      win_T	*wp;
52353d6
  {
52353d6
      wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT
52353d6
! 				    + wp->w_height / 2) / (long)wp->w_height;
52353d6
  }
52353d6
  
52353d6
  /*
52353d6
***************
52353d6
*** 5638,5643 ****
52353d6
--- 5638,5644 ----
52353d6
  {
52353d6
      linenr_T	lnum;
52353d6
      int		sline, line_size;
52353d6
+     int		prev_height = wp->w_height;
52353d6
  
52353d6
      /* Don't want a negative height.  Happens when splitting a tiny window.
52353d6
       * Will equalize heights soon to fix it. */
52353d6
***************
52353d6
*** 5646,5653 ****
52353d6
      if (wp->w_height == height)
52353d6
  	return;	    /* nothing to do */
52353d6
  
52353d6
!     if (wp->w_wrow != wp->w_prev_fraction_row && wp->w_height > 0)
52353d6
! 	set_fraction(wp);
52353d6
  
52353d6
      wp->w_height = height;
52353d6
      wp->w_skipcol = 0;
52353d6
--- 5647,5659 ----
52353d6
      if (wp->w_height == height)
52353d6
  	return;	    /* nothing to do */
52353d6
  
52353d6
!     if (wp->w_height > 0)
52353d6
!     {
52353d6
! 	if (wp == curwin)
52353d6
! 	    validate_cursor();		/* w_wrow needs to be valid */
52353d6
! 	if (wp->w_wrow != wp->w_prev_fraction_row)
52353d6
! 	    set_fraction(wp);
52353d6
!     }
52353d6
  
52353d6
      wp->w_height = height;
52353d6
      wp->w_skipcol = 0;
52353d6
***************
52353d6
*** 5667,5673 ****
52353d6
  	lnum = wp->w_cursor.lnum;
52353d6
  	if (lnum < 1)		/* can happen when starting up */
52353d6
  	    lnum = 1;
52353d6
! 	wp->w_wrow = ((long)wp->w_fraction * (long)height - 1L) / FRACTION_MULT;
52353d6
  	line_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;
52353d6
  	sline = wp->w_wrow - line_size;
52353d6
  
52353d6
--- 5673,5680 ----
52353d6
  	lnum = wp->w_cursor.lnum;
52353d6
  	if (lnum < 1)		/* can happen when starting up */
52353d6
  	    lnum = 1;
52353d6
! 	wp->w_wrow = ((long)wp->w_fraction * (long)height - 1L
52353d6
! 					 + FRACTION_MULT / 2) / FRACTION_MULT;
52353d6
  	line_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;
52353d6
  	sline = wp->w_wrow - line_size;
52353d6
  
52353d6
***************
52353d6
*** 5757,5763 ****
52353d6
  	    update_topline();
52353d6
  	curs_columns(FALSE);	/* validate w_wrow */
52353d6
      }
52353d6
!     wp->w_prev_fraction_row = wp->w_wrow;
52353d6
  
52353d6
      win_comp_scroll(wp);
52353d6
      redraw_win_later(wp, SOME_VALID);
52353d6
--- 5764,5771 ----
52353d6
  	    update_topline();
52353d6
  	curs_columns(FALSE);	/* validate w_wrow */
52353d6
      }
52353d6
!     if (prev_height > 0)
52353d6
! 	wp->w_prev_fraction_row = wp->w_wrow;
52353d6
  
52353d6
      win_comp_scroll(wp);
52353d6
      redraw_win_later(wp, SOME_VALID);
52353d6
*** ../vim-7.4.279/src/version.c	2014-05-07 18:35:25.669216052 +0200
52353d6
--- src/version.c	2014-05-07 20:24:14.313273202 +0200
52353d6
***************
52353d6
*** 736,737 ****
52353d6
--- 736,739 ----
52353d6
  {   /* Add new patch number below this line */
52353d6
+ /**/
52353d6
+     280,
52353d6
  /**/
52353d6
52353d6
-- 
52353d6
~
52353d6
~
52353d6
~
52353d6
".signature" 4 lines, 50 characters written
52353d6
52353d6
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
52353d6
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
52353d6
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
52353d6
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///