]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.852 v7.3.852
authorBram Moolenaar <Bram@vim.org>
Thu, 7 Mar 2013 17:02:30 +0000 (18:02 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 7 Mar 2013 17:02:30 +0000 (18:02 +0100)
Problem:    system() breaks clipboard text. (Yukihiro Nakadaira)
Solution:   Use Xutf8TextPropertyToTextList(). (Christian Brabandt)
            Also do not put the text in the clip buffer if conversion fails.

src/ops.c
src/ui.c
src/version.c

index 9b669b3317216b26f206f3aa427ebc4d47b81e56..f3588eb27901ca370abbda349cedbe3feb7f71ef 100644 (file)
--- a/src/ops.c
+++ b/src/ops.c
@@ -5828,6 +5828,8 @@ x11_export_final_selection()
                                               && len < 1024*1024 && len > 0)
     {
 #ifdef FEAT_MBYTE
+       int ok = TRUE;
+
        /* The CUT_BUFFER0 is supposed to always contain latin1.  Convert from
         * 'enc' when it is a multi-byte encoding.  When 'enc' is an 8-bit
         * encoding conversion usually doesn't work, so keep the text as-is.
@@ -5842,6 +5844,7 @@ x11_export_final_selection()
                int     intlen = len;
                char_u  *conv_str;
 
+               vc.vc_fail = TRUE;
                conv_str = string_convert(&vc, str, &intlen);
                len = intlen;
                if (conv_str != NULL)
@@ -5849,12 +5852,26 @@ x11_export_final_selection()
                    vim_free(str);
                    str = conv_str;
                }
+               else
+               {
+                   ok = FALSE;
+               }
                convert_setup(&vc, NULL, NULL);
            }
+           else
+           {
+               ok = FALSE;
+           }
        }
+
+       /* Do not store the string if conversion failed.  Better to use any
+        * other selection than garbled text. */
+       if (ok)
 #endif
-       XStoreBuffer(dpy, (char *)str, (int)len, 0);
-       XFlush(dpy);
+       {
+           XStoreBuffer(dpy, (char *)str, (int)len, 0);
+           XFlush(dpy);
+       }
     }
 
     vim_free(str);
index 372e0375fcfe5a25899ddd7473470ed340dd0cde..4a4506efc9ec7321f06ec2d3bb786d1f7d57bd80 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
@@ -2119,7 +2119,13 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
        text_prop.encoding = *type;
        text_prop.format = *format;
        text_prop.nitems = len;
-       status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
+#ifdef FEAT_MBYTE
+       if (*type == utf8_atom)
+           status = Xutf8TextPropertyToTextList(X_DISPLAY, &text_prop,
+                                                        &text_list, &n_text);
+       else
+#endif
+           status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
                                                         &text_list, &n_text);
        if (status != Success || n_text < 1)
        {
index 97fdd990cadf2105ad4d97218f4689ceebc18844..eeb4f6128052df479a1c80bf93fb4074d91ba3fa 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    852,
 /**/
     851,
 /**/