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

Patch 7.2.342
Problem:    Popup menu displayed wrong in 'rightleft' mode when there are
	    multi-byte characters.
Solution:   Adjust the column computations. (Dominique Pelle)
Files:	    src/popupmnu.c


*** ../vim-7.2.341/src/popupmnu.c	2008-11-15 14:10:23.000000000 +0100
--- src/popupmnu.c	2010-01-19 17:57:05.000000000 +0100
***************
*** 345,365 ****
  			    if (st != NULL)
  			    {
  				char_u	*rt = reverse_text(st);
- 				char_u	*rt_saved = rt;
- 				int	len, j;
  
  				if (rt != NULL)
  				{
! 				    len = (int)STRLEN(rt);
! 				    if (len > pum_width)
  				    {
! 					for (j = pum_width; j < len; ++j)
  					    mb_ptr_adv(rt);
! 					len = pum_width;
  				    }
! 				    screen_puts_len(rt, len, row,
! 							col - len + 1, attr);
! 				    vim_free(rt_saved);
  				}
  				vim_free(st);
  			    }
--- 345,380 ----
  			    if (st != NULL)
  			    {
  				char_u	*rt = reverse_text(st);
  
  				if (rt != NULL)
  				{
! 				    char_u	*rt_start = rt;
! 				    int		size;
! 
! 				    size = vim_strsize(rt);
! 				    if (size > pum_width)
  				    {
! 					do
! 					{
! 					    size -= has_mbyte
! 						    ? (*mb_ptr2cells)(rt) : 1;
  					    mb_ptr_adv(rt);
! 					} while (size > pum_width);
! 
! 					if (size < pum_width)
! 					{
! 					    /* Most left character requires
! 					     * 2-cells but only 1 cell is
! 					     * available on screen.  Put a
! 					     * '<' on the left of the pum
! 					     * item */
! 					    *(--rt) = '<';
! 					    size++;
! 					}
  				    }
! 				    screen_puts_len(rt, (int)STRLEN(rt),
! 						   row, col - size + 1, attr);
! 				    vim_free(rt_start);
  				}
  				vim_free(st);
  			    }
*** ../vim-7.2.341/src/version.c	2010-01-19 17:40:39.000000000 +0100
--- src/version.c	2010-01-19 18:03:22.000000000 +0100
***************
*** 683,684 ****
--- 683,686 ----
  {   /* Add new patch number below this line */
+ /**/
+     342,
  /**/

-- 
I have a watch cat! Just break in and she'll watch.

 /// 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    ///