Blame SOURCES/7.4.280

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