Hi

On Do, 19 Apr 2012, Christian Brabandt wrote:

> +         case 5:  type = XA_STRING;
> +         default: type = 0;

Upps, small error here. Here is an update.


regards,
Christian
-- 
Übertriebner Tadel schadet Guten mehr als übertriebnes Lob.
                -- Jean Paul

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff --git a/src/ui.c b/src/ui.c
--- a/src/ui.c
+++ b/src/ui.c
@@ -2089,20 +2089,35 @@
 	XTextProperty	text_prop;
 	int		n_text = 0;
 	int		status;
+	int             j;
 
 	text_prop.value = (unsigned char *)value;
 	text_prop.encoding = *type;
 	text_prop.format = *format;
 	text_prop.nitems = len;
-	status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
-							 &text_list, &n_text);
-	if (status != Success || n_text < 1)
+	for (j=0; j<2; j++)
 	{
-	    *(int *)success = FALSE;
-	    return;
+	    if (j==0)
+		status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
+							&text_list, &n_text);
+	    else
+	      /* could be utf-8 encoded */
+		status = Xutf8TextPropertyToTextList(X_DISPLAY, &text_prop,
+							&text_list, &n_text);
+	    if (j == 0 && (status != Success || n_text < 1))
+	      continue;
+	    else if (j==1 && (status != Success || n_text < 1))
+	    {
+		*(int *)success = FALSE;
+		return;
+	    }
+	    else
+	    {
+		p = (char_u *)text_list[0];
+		len = STRLEN(p);
+		break;
+	    }
 	}
-	p = (char_u *)text_list[0];
-	len = STRLEN(p);
     }
     clip_yank_selection(motion_type, p, (long)len, cbd);
 
@@ -2147,12 +2162,16 @@
 #endif
 	    case 3:  type = compound_text_atom; break;
 	    case 4:  type = text_atom;		break;
-	    default: type = XA_STRING;
+	    case 5:  type = XA_STRING;          break;
+	    default: type = 0;
 	}
 #ifdef FEAT_MBYTE
 	if (type == utf8_atom && !enc_utf8)
 	    /* Only request utf-8 when 'encoding' is utf8. */
 	    continue;
+#else
+	if (type == 0)
+	  continue;
 #endif
 	success = MAYBE;
 	XtGetSelectionValue(myShell, cbd->sel_atom, type,

Raspunde prin e-mail lui