Blob Blame History Raw
To: vim-dev@vim.org
Subject: patch 7.1.043
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.043
Problem:    In Ex mode using CTRL-D twice may cause a crash.  Cursor isn't
	    positioned properly after CTRL-D.
Solution:   Set prev_char properly.  Position the cursor correctly. (Antony
	    Scriven)
Files:	    src/ex_getln.c


*** ../vim-7.1.042/src/ex_getln.c	Tue Jul 24 14:32:44 2007
--- src/ex_getln.c	Wed Jul 25 20:57:05 2007
***************
*** 2095,2105 ****
      garray_T	line_ga;
      char_u	*pend;
      int		startcol = 0;
!     int		c1;
      int		escaped = FALSE;	/* CTRL-V typed */
      int		vcol = 0;
      char_u	*p;
!     int		prev_char = 0;
  
      /* Switch cursor on now.  This avoids that it happens after the "\n", which
       * confuses the system function that computes tabstops. */
--- 2095,2105 ----
      garray_T	line_ga;
      char_u	*pend;
      int		startcol = 0;
!     int		c1 = 0;
      int		escaped = FALSE;	/* CTRL-V typed */
      int		vcol = 0;
      char_u	*p;
!     int		prev_char;
  
      /* Switch cursor on now.  This avoids that it happens after the "\n", which
       * confuses the system function that computes tabstops. */
***************
*** 2152,2157 ****
--- 2152,2158 ----
  
  	/* Get one character at a time.  Don't use inchar(), it can't handle
  	 * special characters. */
+ 	prev_char = c1;
  	c1 = vgetc();
  
  	/*
***************
*** 2209,2215 ****
  redraw:
  		/* redraw the line */
  		msg_col = startcol;
- 		windgoto(msg_row, msg_col);
  		vcol = 0;
  		for (p = (char_u *)line_ga.ga_data;
  			  p < (char_u *)line_ga.ga_data + line_ga.ga_len; ++p)
--- 2210,2215 ----
***************
*** 2228,2233 ****
--- 2228,2234 ----
  		    }
  		}
  		msg_clr_eos();
+ 		windgoto(msg_row, msg_col);
  		continue;
  	    }
  
***************
*** 2273,2279 ****
  	if (IS_SPECIAL(c1))
  	    c1 = '?';
  	((char_u *)line_ga.ga_data)[line_ga.ga_len] = c1;
- 	prev_char = c1;
  	if (c1 == '\n')
  	    msg_putchar('\n');
  	else if (c1 == TAB)
--- 2274,2279 ----
*** ../vim-7.1.042/src/version.c	Fri Jul 27 21:32:13 2007
--- src/version.c	Sat Jul 28 14:19:37 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     43,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
48. You get a tatoo that says "This body best viewed with Netscape 3.1 or
    higher."

 /// Bram Moolenaar -- Bram@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    ///