Karsten Hopp 299eb4
To: vim-dev@vim.org
Karsten Hopp 299eb4
Subject: Patch 7.2.268
Karsten Hopp 299eb4
Fcc: outbox
Karsten Hopp 299eb4
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 299eb4
Mime-Version: 1.0
Karsten Hopp 299eb4
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 299eb4
Content-Transfer-Encoding: 8bit
Karsten Hopp 299eb4
------------
Karsten Hopp 299eb4
Karsten Hopp 299eb4
Patch 7.2.268
Karsten Hopp 299eb4
Problem:    Crash when using Python to set cursor beyond end of line.
Karsten Hopp 299eb4
	    (winterTTr)
Karsten Hopp 299eb4
Solution:   Check the column to be valid.
Karsten Hopp 299eb4
Files:	    src/if_python.c
Karsten Hopp 299eb4
Karsten Hopp 299eb4
Karsten Hopp 299eb4
*** ../vim-7.2.267/src/if_python.c	2009-07-09 20:06:30.000000000 +0200
Karsten Hopp 299eb4
--- src/if_python.c	2009-10-10 14:49:10.000000000 +0200
Karsten Hopp 299eb4
***************
Karsten Hopp 299eb4
*** 2058,2063 ****
Karsten Hopp 299eb4
--- 2058,2064 ----
Karsten Hopp 299eb4
      {
Karsten Hopp 299eb4
  	long lnum;
Karsten Hopp 299eb4
  	long col;
Karsten Hopp 299eb4
+ 	long len;
Karsten Hopp 299eb4
  
Karsten Hopp 299eb4
  	if (!PyArg_Parse(val, "(ll)", &lnum, &col))
Karsten Hopp 299eb4
  	    return -1;
Karsten Hopp 299eb4
***************
Karsten Hopp 299eb4
*** 2072,2081 ****
Karsten Hopp 299eb4
  	if (VimErrorCheck())
Karsten Hopp 299eb4
  	    return -1;
Karsten Hopp 299eb4
  
Karsten Hopp 299eb4
! 	/* NO CHECK ON COLUMN - SEEMS NOT TO MATTER */
Karsten Hopp 299eb4
  
Karsten Hopp 299eb4
  	this->win->w_cursor.lnum = lnum;
Karsten Hopp 299eb4
  	this->win->w_cursor.col = col;
Karsten Hopp 299eb4
  	update_screen(VALID);
Karsten Hopp 299eb4
  
Karsten Hopp 299eb4
  	return 0;
Karsten Hopp 299eb4
--- 2073,2088 ----
Karsten Hopp 299eb4
  	if (VimErrorCheck())
Karsten Hopp 299eb4
  	    return -1;
Karsten Hopp 299eb4
  
Karsten Hopp 299eb4
! 	/* When column is out of range silently correct it. */
Karsten Hopp 299eb4
! 	len = STRLEN(ml_get_buf(this->win->w_buffer, lnum, FALSE));
Karsten Hopp 299eb4
! 	if (col > len)
Karsten Hopp 299eb4
! 	    col = len;
Karsten Hopp 299eb4
  
Karsten Hopp 299eb4
  	this->win->w_cursor.lnum = lnum;
Karsten Hopp 299eb4
  	this->win->w_cursor.col = col;
Karsten Hopp 299eb4
+ #ifdef FEAT_VIRTUALEDIT
Karsten Hopp 299eb4
+ 	this->win->w_cursor.coladd = 0;
Karsten Hopp 299eb4
+ #endif
Karsten Hopp 299eb4
  	update_screen(VALID);
Karsten Hopp 299eb4
  
Karsten Hopp 299eb4
  	return 0;
Karsten Hopp 299eb4
*** ../vim-7.2.267/src/version.c	2009-10-07 16:19:52.000000000 +0200
Karsten Hopp 299eb4
--- src/version.c	2009-11-03 11:42:08.000000000 +0100
Karsten Hopp 299eb4
***************
Karsten Hopp 299eb4
*** 678,679 ****
Karsten Hopp 299eb4
--- 678,681 ----
Karsten Hopp 299eb4
  {   /* Add new patch number below this line */
Karsten Hopp 299eb4
+ /**/
Karsten Hopp 299eb4
+     268,
Karsten Hopp 299eb4
  /**/
Karsten Hopp 299eb4
Karsten Hopp 299eb4
-- 
Karsten Hopp 299eb4
VOICE OVER: As the horrendous Black Beast lunged forward, escape for Arthur
Karsten Hopp 299eb4
            and his knights seemed hopeless,  when, suddenly ... the animator
Karsten Hopp 299eb4
            suffered a fatal heart attack.
Karsten Hopp 299eb4
ANIMATOR:   Aaaaagh!
Karsten Hopp 299eb4
VOICE OVER: The cartoon peril was no more ... The Quest for Holy Grail could
Karsten Hopp 299eb4
            continue.
Karsten Hopp 299eb4
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 299eb4
Karsten Hopp 299eb4
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 299eb4
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 299eb4
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 299eb4
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///