jkunstle / rpms / vim

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