1. Richo Healey
  2. vim

Commits

Bram Moolenaar  committed fd4224d

updated for version 7.3.221
Problem: Text from the clipboard is sometimes handled as linewise, but not
consistently.
Solution: Assume the text is linewise when it ends in a CR or NL.

  • Participants
  • Parent commits 307eb4b
  • Branches default
  • Tags v7-3-221

Comments (0)

Files changed (8)

File src/gui_gtk_x11.c

View file
  • Ignore whitespace
     char_u	    *tmpbuf = NULL;
     guchar	    *tmpbuf_utf8 = NULL;
     int		    len;
-    int		    motion_type;
+    int		    motion_type = MAUTO;
 
     if (data->selection == clip_plus.gtk_sel_atom)
 	cbd = &clip_plus;
 
     text = (char_u *)data->data;
     len  = data->length;
-    motion_type = MCHAR;
 
     if (text == NULL || len <= 0)
     {

File src/gui_mac.c

View file
  • Ignore whitespace
     if (flavor)
 	type = **textOfClip;
     else
-	type = (strchr(*textOfClip, '\r') != NULL) ? MLINE : MCHAR;
+	type = MAUTO;
 
     tempclip = lalloc(scrapSize + 1, TRUE);
     mch_memmove(tempclip, *textOfClip + flavor, scrapSize);

File src/ops.c

View file
  • Ignore whitespace
     }
 }
 
-/* Convert from the GUI selection string into the '*'/'+' register */
+/*
+ * Convert from the GUI selection string into the '*'/'+' register.
+ */
     void
 clip_yank_selection(type, str, len, cbd)
     int		type;
     if (yank_type == MBLOCK)
 	yank_type = MAUTO;
 #endif
-    if (yank_type == MAUTO)
-	yank_type = ((len > 0 && (str[len - 1] == '\n' || str[len - 1] == '\r'))
-							     ? MLINE : MCHAR);
     str_to_reg(y_current, yank_type, str, len, block_len);
 
 # ifdef FEAT_CLIPBOARD
  * is appended.
  */
     static void
-str_to_reg(y_ptr, type, str, len, blocklen)
+str_to_reg(y_ptr, yank_type, str, len, blocklen)
     struct yankreg	*y_ptr;		/* pointer to yank register */
-    int			type;		/* MCHAR, MLINE or MBLOCK */
+    int			yank_type;	/* MCHAR, MLINE, MBLOCK, MAUTO */
     char_u		*str;		/* string to put in register */
     long		len;		/* length of string */
     long		blocklen;	/* width of Visual block */
 {
+    int		type;			/* MCHAR, MLINE or MBLOCK */
     int		lnum;
     long	start;
     long	i;
     if (y_ptr->y_array == NULL)		/* NULL means empty register */
 	y_ptr->y_size = 0;
 
+    if (yank_type == MAUTO)
+	type = ((len > 0 && (str[len - 1] == NL || str[len - 1] == CAR))
+							     ? MLINE : MCHAR);
+    else
+	type = yank_type;
+
     /*
      * Count the number of lines within the string
      */

File src/os_msdos.c

View file
  • Ignore whitespace
     void
 clip_mch_request_selection(VimClipboard *cbd)
 {
-    int		type = MCHAR;
+    int		type = MAUTO;
     char_u	*pAllocated = NULL;
     char_u	*pClipText = NULL;
     int		clip_data_format = 0;
 	{
 	    clip_data_format = CF_TEXT;
 	    pClipText = pAllocated;
-	    type = (vim_strchr((char*)pClipText, '\r') != NULL) ? MLINE : MCHAR;
 	}
 
 	else if ((pAllocated = Win16GetClipboardData(CF_OEMTEXT)) != NULL)
 	{
 	    clip_data_format = CF_OEMTEXT;
 	    pClipText = pAllocated;
-	    type = (vim_strchr((char*)pClipText, '\r') != NULL) ? MLINE : MCHAR;
 	}
 
 	/* Did we get anything? */

File src/os_mswin.c

View file
  • Ignore whitespace
     {
 	char_u *temp_clipboard;
 
-	/* If the type is not known guess it. */
+	/* If the type is not known detect it. */
 	if (metadata.type == -1)
-	    metadata.type = (vim_strchr(str, '\n') == NULL) ? MCHAR : MLINE;
+	    metadata.type = MAUTO;
 
 	/* Translate <CR><NL> into <NL>. */
 	temp_clipboard = crnl_to_nl(str, &str_size);

File src/os_qnx.c

View file
  • Ignore whitespace
 	    clip_length  = clip_header->length - 1;
 
 	    if( clip_text != NULL && is_type_set == FALSE )
-		type = (strchr( clip_text, '\r' ) != NULL) ? MLINE : MCHAR;
+		type = MAUTO;
 	}
 
 	if( (clip_text != NULL) && (clip_length > 0) )

File src/ui.c

View file
  • Ignore whitespace
 
 #if defined(FEAT_HANGULIN) || defined(PROTO)
     void
-push_raw_key (s, len)
+push_raw_key(s, len)
     char_u  *s;
     int	    len;
 {
     long_u	*length;
     int		*format;
 {
-    int		motion_type;
+    int		motion_type = MAUTO;
     long_u	len;
     char_u	*p;
     char	**text_list = NULL;
 	*(int *)success = FALSE;
 	return;
     }
-    motion_type = MCHAR;
     p = (char_u *)value;
     len = *length;
     if (*type == vim_atom)

File src/version.c

View file
  • Ignore whitespace
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    221,
+/**/
     220,
 /**/
     219,