rpms/vim/devel 7.0.149,NONE,1.1

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Nov 6 14:33:23 UTC 2006


Author: karsten

Update of /cvs/dist/rpms/vim/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv7181

Added Files:
	7.0.149 
Log Message:
- patchlevel 149


--- NEW FILE 7.0.149 ---
To: vim-dev at vim.org
Subject: Patch 7.0.149
Fcc: outbox
From: Bram Moolenaar <Bram at moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.0.149
Problem:    When resizing a window that shows "~" lines the text sometimes
	    jumps down.
Solution:   Remove code that uses "~" lines in some situations.  Fix the
            computation of the screen line of the cursor.  Also set w_skipcol
	    to handle very long lines.
Files:	    src/misc1.c, src/window.c


*** ../vim-7.0.148/src/misc1.c	Tue Oct 17 11:12:28 2006
--- src/misc1.c	Tue Oct 24 17:33:39 2006
***************
*** 1761,1775 ****
       * Add column offset for 'number', 'foldcolumn', etc.
       */
      width = W_WIDTH(wp) - win_col_off(wp);
!     if (width > 0)
!     {
! 	lines += 1;
! 	if (col >= width)
! 	    lines += (col - width) / (width + win_col_off2(wp));
! 	if (lines <= wp->w_height)
! 	    return lines;
!     }
!     return (int)(wp->w_height);	    /* maximum length */
  }
  
      int
--- 1761,1773 ----
       * Add column offset for 'number', 'foldcolumn', etc.
       */
      width = W_WIDTH(wp) - win_col_off(wp);
!     if (width <= 0)
! 	return 9999;
! 
!     lines += 1;
!     if (col > width)
! 	lines += (col - width) / (width + win_col_off2(wp)) + 1;
!     return lines;
  }
  
      int
*** ../vim-7.0.148/src/window.c	Tue Sep  5 16:29:38 2006
--- src/window.c	Tue Oct 24 20:39:56 2006
***************
*** 5189,5199 ****
      int		height;
  {
      linenr_T	lnum;
-     linenr_T	bot;
      int		sline, line_size;
-     int		space;
-     int		did_below = FALSE;
-     int		old_height = wp->w_height;
  #define FRACTION_MULT	16384L
  
      /* Don't want a negative height.  Happens when splitting a tiny window.
--- 5189,5195 ----
***************
*** 5228,5281 ****
  	wp->w_wrow = ((long)wp->w_fraction * (long)height - 1L) / FRACTION_MULT;
  	line_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;
  	sline = wp->w_wrow - line_size;
  	if (sline < 0)
  	{
  	    /*
  	     * Cursor line would go off top of screen if w_wrow was this high.
  	     */
  	    wp->w_wrow = line_size;
  	}
  	else
  	{
! 	    space = height - 1;
! 
! 	    while (lnum > 1)
  	    {
- 		/* When using "~" lines stop when at the old topline, don't
- 		 * scroll down. */
- 		if (did_below && height < old_height && lnum <= wp->w_topline)
- 		    sline = 0;
- 
- 		space -= line_size;
- 		if (space > 0 && sline <= 0 && !did_below)
- 		{
- 		    /* Try to use "~" lines below the text to avoid that text
- 		     * is above the window while there are empty lines.
- 		     * Subtract the rows below the cursor from "space" and
- 		     * give the rest to "sline". */
- 		    did_below = TRUE;
- 		    bot = wp->w_cursor.lnum;
- 		    while (space > 0)
- 		    {
- 			if (wp->w_buffer->b_ml.ml_line_count - bot >= space)
- 			    space = 0;
- 			else
- 			{
- #ifdef FEAT_FOLDING
- 			    hasFoldingWin(wp, bot, NULL, &bot, TRUE, NULL);
- #endif
- 			    if (bot >= wp->w_buffer->b_ml.ml_line_count)
- 				break;
- 			    ++bot;
- 			    space -= plines_win(wp, bot, TRUE);
- 			}
- 		    }
- 		    if (bot == wp->w_buffer->b_ml.ml_line_count && space > 0)
- 			sline += space;
- 		}
- 		if (sline <= 0)
- 		    break;
- 
  #ifdef FEAT_FOLDING
  		hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
  		if (lnum == 1)
--- 5224,5267 ----
  	wp->w_wrow = ((long)wp->w_fraction * (long)height - 1L) / FRACTION_MULT;
  	line_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;
  	sline = wp->w_wrow - line_size;
+ 
+ 	if (sline >= 0)
+ 	{
+ 	    /* Make sure the whole cursor line is visible, if possible. */
+ 	    int rows = plines_win(wp, lnum, FALSE);
+ 
+ 	    if (sline > wp->w_height - rows)
+ 	    {
+ 		sline = wp->w_height - rows;
+ 		wp->w_wrow -= rows - line_size;
+ 	    }
+ 	}
+ 
  	if (sline < 0)
  	{
  	    /*
  	     * Cursor line would go off top of screen if w_wrow was this high.
+ 	     * Make cursor line the first line in the window.  If not enough
+ 	     * room use w_skipcol;
  	     */
  	    wp->w_wrow = line_size;
+ 	    if (wp->w_wrow >= wp->w_height
+ 				       && (W_WIDTH(wp) - win_col_off(wp)) > 0)
+ 	    {
+ 		wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp);
+ 		--wp->w_wrow;
+ 		while (wp->w_wrow >= wp->w_height)
+ 		{
+ 		    wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp)
+ 							   + win_col_off2(wp);
+ 		    --wp->w_wrow;
+ 		}
+ 	    }
  	}
  	else
  	{
! 	    while (sline > 0 && lnum > 1)
  	    {
  #ifdef FEAT_FOLDING
  		hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
  		if (lnum == 1)
*** ../vim-7.0.148/src/version.c	Tue Oct 24 13:51:47 2006
--- src/version.c	Tue Oct 24 21:13:31 2006
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     149,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
104. When people ask about the Presidential Election you ask "Which country?"

 /// Bram Moolenaar -- Bram at Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///




More information about the fedora-cvs-commits mailing list