Karsten Hopp 0c1b46
To: vim_dev@googlegroups.com
Karsten Hopp 0c1b46
Subject: Patch 7.3.852
Karsten Hopp 0c1b46
Fcc: outbox
Karsten Hopp 0c1b46
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 0c1b46
Mime-Version: 1.0
Karsten Hopp 0c1b46
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 0c1b46
Content-Transfer-Encoding: 8bit
Karsten Hopp 0c1b46
------------
Karsten Hopp 0c1b46
Karsten Hopp 0c1b46
Patch 7.3.852
Karsten Hopp 0c1b46
Problem:    system() breaks clipboard text. (Yukihiro Nakadaira)
Karsten Hopp 0c1b46
Solution:   Use Xutf8TextPropertyToTextList(). (Christian Brabandt)
Karsten Hopp 0c1b46
	    Also do not put the text in the clip buffer if conversion fails.
Karsten Hopp 0c1b46
Files:	    src/ui.c, src/ops.c
Karsten Hopp 0c1b46
Karsten Hopp 0c1b46
Karsten Hopp 0c1b46
*** ../vim-7.3.851/src/ui.c	2012-10-21 00:58:34.000000000 +0200
Karsten Hopp 0c1b46
--- src/ui.c	2013-03-07 17:30:37.000000000 +0100
Karsten Hopp 0c1b46
***************
Karsten Hopp 0c1b46
*** 2119,2125 ****
Karsten Hopp 0c1b46
  	text_prop.encoding = *type;
Karsten Hopp 0c1b46
  	text_prop.format = *format;
Karsten Hopp 0c1b46
  	text_prop.nitems = len;
Karsten Hopp 0c1b46
! 	status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
Karsten Hopp 0c1b46
  							 &text_list, &n_text);
Karsten Hopp 0c1b46
  	if (status != Success || n_text < 1)
Karsten Hopp 0c1b46
  	{
Karsten Hopp 0c1b46
--- 2119,2131 ----
Karsten Hopp 0c1b46
  	text_prop.encoding = *type;
Karsten Hopp 0c1b46
  	text_prop.format = *format;
Karsten Hopp 0c1b46
  	text_prop.nitems = len;
Karsten Hopp 0c1b46
! #ifdef FEAT_MBYTE
Karsten Hopp 0c1b46
! 	if (*type == utf8_atom)
Karsten Hopp 0c1b46
! 	    status = Xutf8TextPropertyToTextList(X_DISPLAY, &text_prop,
Karsten Hopp 0c1b46
! 							 &text_list, &n_text);
Karsten Hopp 0c1b46
! 	else
Karsten Hopp 0c1b46
! #endif
Karsten Hopp 0c1b46
! 	    status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
Karsten Hopp 0c1b46
  							 &text_list, &n_text);
Karsten Hopp 0c1b46
  	if (status != Success || n_text < 1)
Karsten Hopp 0c1b46
  	{
Karsten Hopp 0c1b46
*** ../vim-7.3.851/src/ops.c	2012-12-12 16:11:28.000000000 +0100
Karsten Hopp 0c1b46
--- src/ops.c	2013-03-07 17:55:59.000000000 +0100
Karsten Hopp 0c1b46
***************
Karsten Hopp 0c1b46
*** 5828,5833 ****
Karsten Hopp 0c1b46
--- 5828,5835 ----
Karsten Hopp 0c1b46
  					       && len < 1024*1024 && len > 0)
Karsten Hopp 0c1b46
      {
Karsten Hopp 0c1b46
  #ifdef FEAT_MBYTE
Karsten Hopp 0c1b46
+ 	int ok = TRUE;
Karsten Hopp 0c1b46
+ 
Karsten Hopp 0c1b46
  	/* The CUT_BUFFER0 is supposed to always contain latin1.  Convert from
Karsten Hopp 0c1b46
  	 * 'enc' when it is a multi-byte encoding.  When 'enc' is an 8-bit
Karsten Hopp 0c1b46
  	 * encoding conversion usually doesn't work, so keep the text as-is.
Karsten Hopp 0c1b46
***************
Karsten Hopp 0c1b46
*** 5842,5847 ****
Karsten Hopp 0c1b46
--- 5844,5850 ----
Karsten Hopp 0c1b46
  		int	intlen = len;
Karsten Hopp 0c1b46
  		char_u	*conv_str;
Karsten Hopp 0c1b46
  
Karsten Hopp 0c1b46
+ 		vc.vc_fail = TRUE;
Karsten Hopp 0c1b46
  		conv_str = string_convert(&vc, str, &intlen);
Karsten Hopp 0c1b46
  		len = intlen;
Karsten Hopp 0c1b46
  		if (conv_str != NULL)
Karsten Hopp 0c1b46
***************
Karsten Hopp 0c1b46
*** 5849,5860 ****
Karsten Hopp 0c1b46
  		    vim_free(str);
Karsten Hopp 0c1b46
  		    str = conv_str;
Karsten Hopp 0c1b46
  		}
Karsten Hopp 0c1b46
  		convert_setup(&vc, NULL, NULL);
Karsten Hopp 0c1b46
  	    }
Karsten Hopp 0c1b46
  	}
Karsten Hopp 0c1b46
  #endif
Karsten Hopp 0c1b46
! 	XStoreBuffer(dpy, (char *)str, (int)len, 0);
Karsten Hopp 0c1b46
! 	XFlush(dpy);
Karsten Hopp 0c1b46
      }
Karsten Hopp 0c1b46
  
Karsten Hopp 0c1b46
      vim_free(str);
Karsten Hopp 0c1b46
--- 5852,5877 ----
Karsten Hopp 0c1b46
  		    vim_free(str);
Karsten Hopp 0c1b46
  		    str = conv_str;
Karsten Hopp 0c1b46
  		}
Karsten Hopp 0c1b46
+ 		else
Karsten Hopp 0c1b46
+ 		{
Karsten Hopp 0c1b46
+ 		    ok = FALSE;
Karsten Hopp 0c1b46
+ 		}
Karsten Hopp 0c1b46
  		convert_setup(&vc, NULL, NULL);
Karsten Hopp 0c1b46
  	    }
Karsten Hopp 0c1b46
+ 	    else
Karsten Hopp 0c1b46
+ 	    {
Karsten Hopp 0c1b46
+ 		ok = FALSE;
Karsten Hopp 0c1b46
+ 	    }
Karsten Hopp 0c1b46
  	}
Karsten Hopp 0c1b46
+ 
Karsten Hopp 0c1b46
+ 	/* Do not store the string if conversion failed.  Better to use any
Karsten Hopp 0c1b46
+ 	 * other selection than garbled text. */
Karsten Hopp 0c1b46
+ 	if (ok)
Karsten Hopp 0c1b46
  #endif
Karsten Hopp 0c1b46
! 	{
Karsten Hopp 0c1b46
! 	    XStoreBuffer(dpy, (char *)str, (int)len, 0);
Karsten Hopp 0c1b46
! 	    XFlush(dpy);
Karsten Hopp 0c1b46
! 	}
Karsten Hopp 0c1b46
      }
Karsten Hopp 0c1b46
  
Karsten Hopp 0c1b46
      vim_free(str);
Karsten Hopp 0c1b46
*** ../vim-7.3.851/src/version.c	2013-03-07 16:41:26.000000000 +0100
Karsten Hopp 0c1b46
--- src/version.c	2013-03-07 18:01:08.000000000 +0100
Karsten Hopp 0c1b46
***************
Karsten Hopp 0c1b46
*** 730,731 ****
Karsten Hopp 0c1b46
--- 730,733 ----
Karsten Hopp 0c1b46
  {   /* Add new patch number below this line */
Karsten Hopp 0c1b46
+ /**/
Karsten Hopp 0c1b46
+     852,
Karsten Hopp 0c1b46
  /**/
Karsten Hopp 0c1b46
Karsten Hopp 0c1b46
-- 
Karsten Hopp 0c1b46
Tips for aliens in New York: Land anywhere.  Central Park, anywhere.
Karsten Hopp 0c1b46
No one will care or indeed even notice.
Karsten Hopp 0c1b46
		-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
Karsten Hopp 0c1b46
Karsten Hopp 0c1b46
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 0c1b46
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 0c1b46
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 0c1b46
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///