Karsten Hopp 6fc23b
To: vim-dev@vim.org
Karsten Hopp 6fc23b
Subject: Patch 7.2.391
Karsten Hopp 6fc23b
Fcc: outbox
Karsten Hopp 6fc23b
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 6fc23b
Mime-Version: 1.0
Karsten Hopp 6fc23b
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 6fc23b
Content-Transfer-Encoding: 8bit
Karsten Hopp 6fc23b
------------
Karsten Hopp 6fc23b
Karsten Hopp 6fc23b
Patch 7.2.391
Karsten Hopp 6fc23b
Problem:    Internal alloc(0) error when doing "CTRL-V $ c". (Martti Kuparinen)
Karsten Hopp 6fc23b
Solution:   Fix computations in getvcol(). (partly by Lech Lorens)
Karsten Hopp 6fc23b
Files:	    src/charset.c, src/memline.c
Karsten Hopp 6fc23b
Karsten Hopp 6fc23b
Karsten Hopp 6fc23b
*** ../vim-7.2.390/src/charset.c	2009-11-03 16:03:59.000000000 +0100
Karsten Hopp 6fc23b
--- src/charset.c	2010-03-10 14:38:14.000000000 +0100
Karsten Hopp 6fc23b
***************
Karsten Hopp 6fc23b
*** 1255,1261 ****
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
      vcol = 0;
Karsten Hopp 6fc23b
      ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE);
Karsten Hopp 6fc23b
!     posptr = ptr + pos->col;
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
      /*
Karsten Hopp 6fc23b
       * This function is used very often, do some speed optimizations.
Karsten Hopp 6fc23b
--- 1255,1264 ----
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
      vcol = 0;
Karsten Hopp 6fc23b
      ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE);
Karsten Hopp 6fc23b
!     if (pos->col == MAXCOL)
Karsten Hopp 6fc23b
! 	posptr = NULL;  /* continue until the NUL */
Karsten Hopp 6fc23b
!     else
Karsten Hopp 6fc23b
! 	posptr = ptr + pos->col;
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
      /*
Karsten Hopp 6fc23b
       * This function is used very often, do some speed optimizations.
Karsten Hopp 6fc23b
***************
Karsten Hopp 6fc23b
*** 1313,1319 ****
Karsten Hopp 6fc23b
  		    incr = CHARSIZE(c);
Karsten Hopp 6fc23b
  	    }
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
! 	    if (ptr >= posptr)	/* character at pos->col */
Karsten Hopp 6fc23b
  		break;
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
  	    vcol += incr;
Karsten Hopp 6fc23b
--- 1316,1322 ----
Karsten Hopp 6fc23b
  		    incr = CHARSIZE(c);
Karsten Hopp 6fc23b
  	    }
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
! 	    if (posptr != NULL && ptr >= posptr) /* character at pos->col */
Karsten Hopp 6fc23b
  		break;
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
  	    vcol += incr;
Karsten Hopp 6fc23b
***************
Karsten Hopp 6fc23b
*** 1334,1340 ****
Karsten Hopp 6fc23b
  		break;
Karsten Hopp 6fc23b
  	    }
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
! 	    if (ptr >= posptr)	/* character at pos->col */
Karsten Hopp 6fc23b
  		break;
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
  	    vcol += incr;
Karsten Hopp 6fc23b
--- 1337,1343 ----
Karsten Hopp 6fc23b
  		break;
Karsten Hopp 6fc23b
  	    }
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
! 	    if (posptr != NULL && ptr >= posptr) /* character at pos->col */
Karsten Hopp 6fc23b
  		break;
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
  	    vcol += incr;
Karsten Hopp 6fc23b
*** ../vim-7.2.390/src/memline.c	2010-02-11 18:54:38.000000000 +0100
Karsten Hopp 6fc23b
--- src/memline.c	2010-03-10 14:38:25.000000000 +0100
Karsten Hopp 6fc23b
***************
Karsten Hopp 6fc23b
*** 2113,2124 ****
Karsten Hopp 6fc23b
      if (buf->b_ml.ml_mfp == NULL)	/* there are no lines */
Karsten Hopp 6fc23b
  	return (char_u *)"";
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
! /*
Karsten Hopp 6fc23b
!  * See if it is the same line as requested last time.
Karsten Hopp 6fc23b
!  * Otherwise may need to flush last used line.
Karsten Hopp 6fc23b
!  * Don't use the last used line when 'swapfile' is reset, need to load all
Karsten Hopp 6fc23b
!  * blocks.
Karsten Hopp 6fc23b
!  */
Karsten Hopp 6fc23b
      if (buf->b_ml.ml_line_lnum != lnum || mf_dont_release)
Karsten Hopp 6fc23b
      {
Karsten Hopp 6fc23b
  	ml_flush_line(buf);
Karsten Hopp 6fc23b
--- 2113,2124 ----
Karsten Hopp 6fc23b
      if (buf->b_ml.ml_mfp == NULL)	/* there are no lines */
Karsten Hopp 6fc23b
  	return (char_u *)"";
Karsten Hopp 6fc23b
  
Karsten Hopp 6fc23b
!     /*
Karsten Hopp 6fc23b
!      * See if it is the same line as requested last time.
Karsten Hopp 6fc23b
!      * Otherwise may need to flush last used line.
Karsten Hopp 6fc23b
!      * Don't use the last used line when 'swapfile' is reset, need to load all
Karsten Hopp 6fc23b
!      * blocks.
Karsten Hopp 6fc23b
!      */
Karsten Hopp 6fc23b
      if (buf->b_ml.ml_line_lnum != lnum || mf_dont_release)
Karsten Hopp 6fc23b
      {
Karsten Hopp 6fc23b
  	ml_flush_line(buf);
Karsten Hopp 6fc23b
*** ../vim-7.2.390/src/version.c	2010-03-10 14:15:28.000000000 +0100
Karsten Hopp 6fc23b
--- src/version.c	2010-03-10 14:31:02.000000000 +0100
Karsten Hopp 6fc23b
***************
Karsten Hopp 6fc23b
*** 683,684 ****
Karsten Hopp 6fc23b
--- 683,686 ----
Karsten Hopp 6fc23b
  {   /* Add new patch number below this line */
Karsten Hopp 6fc23b
+ /**/
Karsten Hopp 6fc23b
+     391,
Karsten Hopp 6fc23b
  /**/
Karsten Hopp 6fc23b
Karsten Hopp 6fc23b
-- 
Karsten Hopp 6fc23b
WOMAN:   King of the who?
Karsten Hopp 6fc23b
ARTHUR:  The Britons.
Karsten Hopp 6fc23b
WOMAN:   Who are the Britons?
Karsten Hopp 6fc23b
ARTHUR:  Well, we all are. we're all Britons and I am your king.
Karsten Hopp 6fc23b
                                  The Quest for the Holy Grail (Monty Python)
Karsten Hopp 6fc23b
Karsten Hopp 6fc23b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 6fc23b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 6fc23b
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 6fc23b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///