Blame SOURCES/7.4.324

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.324
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.324
22c937
Problem:    In Ex mode, cyrillic characters are not handled. (Stas Malavin)
22c937
Solution:   Support multi-byte characters in Ex mode. (Yukihiro Nakadaira)
22c937
Files:	    src/ex_getln.c
22c937
22c937
22c937
*** ../vim-7.4.323/src/ex_getln.c	2014-05-29 14:36:26.156862577 +0200
22c937
--- src/ex_getln.c	2014-06-12 19:33:10.440522741 +0200
22c937
***************
22c937
*** 2188,2193 ****
22c937
--- 2188,2194 ----
22c937
      int		vcol = 0;
22c937
      char_u	*p;
22c937
      int		prev_char;
22c937
+     int		len;
22c937
  
22c937
      /* Switch cursor on now.  This avoids that it happens after the "\n", which
22c937
       * confuses the system function that computes tabstops. */
22c937
***************
22c937
*** 2264,2270 ****
22c937
  	    {
22c937
  		if (line_ga.ga_len > 0)
22c937
  		{
22c937
! 		    --line_ga.ga_len;
22c937
  		    goto redraw;
22c937
  		}
22c937
  		continue;
22c937
--- 2265,2281 ----
22c937
  	    {
22c937
  		if (line_ga.ga_len > 0)
22c937
  		{
22c937
! #ifdef FEAT_MBYTE
22c937
! 		    if (has_mbyte)
22c937
! 		    {
22c937
! 			p = (char_u *)line_ga.ga_data;
22c937
! 			p[line_ga.ga_len] = NUL;
22c937
! 			len = (*mb_head_off)(p, p + line_ga.ga_len - 1) + 1;
22c937
! 			line_ga.ga_len -= len;
22c937
! 		    }
22c937
! 		    else
22c937
! #endif
22c937
! 			--line_ga.ga_len;
22c937
  		    goto redraw;
22c937
  		}
22c937
  		continue;
22c937
***************
22c937
*** 2280,2286 ****
22c937
  
22c937
  	    if (c1 == Ctrl_T)
22c937
  	    {
22c937
! 		long        sw = get_sw_value(curbuf);
22c937
  
22c937
  		p = (char_u *)line_ga.ga_data;
22c937
  		p[line_ga.ga_len] = NUL;
22c937
--- 2291,2297 ----
22c937
  
22c937
  	    if (c1 == Ctrl_T)
22c937
  	    {
22c937
! 		long	    sw = get_sw_value(curbuf);
22c937
  
22c937
  		p = (char_u *)line_ga.ga_data;
22c937
  		p[line_ga.ga_len] = NUL;
22c937
***************
22c937
*** 2300,2307 ****
22c937
  		/* redraw the line */
22c937
  		msg_col = startcol;
22c937
  		vcol = 0;
22c937
! 		for (p = (char_u *)line_ga.ga_data;
22c937
! 			  p < (char_u *)line_ga.ga_data + line_ga.ga_len; ++p)
22c937
  		{
22c937
  		    if (*p == TAB)
22c937
  		    {
22c937
--- 2311,2319 ----
22c937
  		/* redraw the line */
22c937
  		msg_col = startcol;
22c937
  		vcol = 0;
22c937
! 		p = (char_u *)line_ga.ga_data;
22c937
! 		p[line_ga.ga_len] = NUL;
22c937
! 		while (p < (char_u *)line_ga.ga_data + line_ga.ga_len)
22c937
  		{
22c937
  		    if (*p == TAB)
22c937
  		    {
22c937
***************
22c937
*** 2309,2319 ****
22c937
  			{
22c937
  			    msg_putchar(' ');
22c937
  			} while (++vcol % 8);
22c937
  		    }
22c937
  		    else
22c937
  		    {
22c937
! 			msg_outtrans_len(p, 1);
22c937
! 			vcol += char2cells(*p);
22c937
  		    }
22c937
  		}
22c937
  		msg_clr_eos();
22c937
--- 2321,2334 ----
22c937
  			{
22c937
  			    msg_putchar(' ');
22c937
  			} while (++vcol % 8);
22c937
+ 			++p;
22c937
  		    }
22c937
  		    else
22c937
  		    {
22c937
! 			len = MB_PTR2LEN(p);
22c937
! 			msg_outtrans_len(p, len);
22c937
! 			vcol += ptr2cells(p);
22c937
! 			p += len;
22c937
  		    }
22c937
  		}
22c937
  		msg_clr_eos();
22c937
***************
22c937
*** 2362,2368 ****
22c937
  
22c937
  	if (IS_SPECIAL(c1))
22c937
  	    c1 = '?';
22c937
! 	((char_u *)line_ga.ga_data)[line_ga.ga_len] = c1;
22c937
  	if (c1 == '\n')
22c937
  	    msg_putchar('\n');
22c937
  	else if (c1 == TAB)
22c937
--- 2377,2392 ----
22c937
  
22c937
  	if (IS_SPECIAL(c1))
22c937
  	    c1 = '?';
22c937
! #ifdef FEAT_MBYTE
22c937
! 	if (has_mbyte)
22c937
! 	    len = (*mb_char2bytes)(c1,
22c937
! 				  (char_u *)line_ga.ga_data + line_ga.ga_len);
22c937
! 	else
22c937
! #endif
22c937
! 	{
22c937
! 	    len = 1;
22c937
! 	    ((char_u *)line_ga.ga_data)[line_ga.ga_len] = c1;
22c937
! 	}
22c937
  	if (c1 == '\n')
22c937
  	    msg_putchar('\n');
22c937
  	else if (c1 == TAB)
22c937
***************
22c937
*** 2376,2385 ****
22c937
  	else
22c937
  	{
22c937
  	    msg_outtrans_len(
22c937
! 		     ((char_u *)line_ga.ga_data) + line_ga.ga_len, 1);
22c937
  	    vcol += char2cells(c1);
22c937
  	}
22c937
! 	++line_ga.ga_len;
22c937
  	escaped = FALSE;
22c937
  
22c937
  	windgoto(msg_row, msg_col);
22c937
--- 2400,2409 ----
22c937
  	else
22c937
  	{
22c937
  	    msg_outtrans_len(
22c937
! 		     ((char_u *)line_ga.ga_data) + line_ga.ga_len, len);
22c937
  	    vcol += char2cells(c1);
22c937
  	}
22c937
! 	line_ga.ga_len += len;
22c937
  	escaped = FALSE;
22c937
  
22c937
  	windgoto(msg_row, msg_col);
22c937
*** ../vim-7.4.323/src/version.c	2014-06-12 18:39:16.828400409 +0200
22c937
--- src/version.c	2014-06-12 19:37:40.296532950 +0200
22c937
***************
22c937
*** 736,737 ****
22c937
--- 736,739 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     324,
22c937
  /**/
22c937
22c937
-- 
22c937
ZOOT:  I'm afraid our life must seem very dull and quiet compared to yours.
22c937
       We are but eightscore young blondes, all between sixteen and
22c937
       nineteen-and-a-half, cut off in this castle, with no one to protect us.
22c937
       Oooh.  It is a lonely life ... bathing ...  dressing ... undressing ...
22c937
       making exciting underwear....
22c937
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///