544cd38
To: vim-dev@vim.org
544cd38
Subject: patch 7.1.043
544cd38
Fcc: outbox
544cd38
From: Bram Moolenaar <Bram@moolenaar.net>
544cd38
Mime-Version: 1.0
544cd38
Content-Type: text/plain; charset=ISO-8859-1
544cd38
Content-Transfer-Encoding: 8bit
544cd38
------------
544cd38
544cd38
Patch 7.1.043
544cd38
Problem:    In Ex mode using CTRL-D twice may cause a crash.  Cursor isn't
544cd38
	    positioned properly after CTRL-D.
544cd38
Solution:   Set prev_char properly.  Position the cursor correctly. (Antony
544cd38
	    Scriven)
544cd38
Files:	    src/ex_getln.c
544cd38
544cd38
544cd38
*** ../vim-7.1.042/src/ex_getln.c	Tue Jul 24 14:32:44 2007
544cd38
--- src/ex_getln.c	Wed Jul 25 20:57:05 2007
544cd38
***************
544cd38
*** 2095,2105 ****
544cd38
      garray_T	line_ga;
544cd38
      char_u	*pend;
544cd38
      int		startcol = 0;
544cd38
!     int		c1;
544cd38
      int		escaped = FALSE;	/* CTRL-V typed */
544cd38
      int		vcol = 0;
544cd38
      char_u	*p;
544cd38
!     int		prev_char = 0;
544cd38
  
544cd38
      /* Switch cursor on now.  This avoids that it happens after the "\n", which
544cd38
       * confuses the system function that computes tabstops. */
544cd38
--- 2095,2105 ----
544cd38
      garray_T	line_ga;
544cd38
      char_u	*pend;
544cd38
      int		startcol = 0;
544cd38
!     int		c1 = 0;
544cd38
      int		escaped = FALSE;	/* CTRL-V typed */
544cd38
      int		vcol = 0;
544cd38
      char_u	*p;
544cd38
!     int		prev_char;
544cd38
  
544cd38
      /* Switch cursor on now.  This avoids that it happens after the "\n", which
544cd38
       * confuses the system function that computes tabstops. */
544cd38
***************
544cd38
*** 2152,2157 ****
544cd38
--- 2152,2158 ----
544cd38
  
544cd38
  	/* Get one character at a time.  Don't use inchar(), it can't handle
544cd38
  	 * special characters. */
544cd38
+ 	prev_char = c1;
544cd38
  	c1 = vgetc();
544cd38
  
544cd38
  	/*
544cd38
***************
544cd38
*** 2209,2215 ****
544cd38
  redraw:
544cd38
  		/* redraw the line */
544cd38
  		msg_col = startcol;
544cd38
- 		windgoto(msg_row, msg_col);
544cd38
  		vcol = 0;
544cd38
  		for (p = (char_u *)line_ga.ga_data;
544cd38
  			  p < (char_u *)line_ga.ga_data + line_ga.ga_len; ++p)
544cd38
--- 2210,2215 ----
544cd38
***************
544cd38
*** 2228,2233 ****
544cd38
--- 2228,2234 ----
544cd38
  		    }
544cd38
  		}
544cd38
  		msg_clr_eos();
544cd38
+ 		windgoto(msg_row, msg_col);
544cd38
  		continue;
544cd38
  	    }
544cd38
  
544cd38
***************
544cd38
*** 2273,2279 ****
544cd38
  	if (IS_SPECIAL(c1))
544cd38
  	    c1 = '?';
544cd38
  	((char_u *)line_ga.ga_data)[line_ga.ga_len] = c1;
544cd38
- 	prev_char = c1;
544cd38
  	if (c1 == '\n')
544cd38
  	    msg_putchar('\n');
544cd38
  	else if (c1 == TAB)
544cd38
--- 2274,2279 ----
544cd38
*** ../vim-7.1.042/src/version.c	Fri Jul 27 21:32:13 2007
544cd38
--- src/version.c	Sat Jul 28 14:19:37 2007
544cd38
***************
544cd38
*** 668,669 ****
544cd38
--- 668,671 ----
544cd38
  {   /* Add new patch number below this line */
544cd38
+ /**/
544cd38
+     43,
544cd38
  /**/
544cd38
544cd38
-- 
544cd38
hundred-and-one symptoms of being an internet addict:
544cd38
48. You get a tatoo that says "This body best viewed with Netscape 3.1 or
544cd38
    higher."
544cd38
544cd38
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
544cd38
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
544cd38
\\\        download, build and distribute -- http://www.A-A-P.org        ///
544cd38
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///