9aaaf6c
To: vim_dev@googlegroups.com
9aaaf6c
Subject: Patch 7.3.221
9aaaf6c
Fcc: outbox
9aaaf6c
From: Bram Moolenaar <Bram@moolenaar.net>
9aaaf6c
Mime-Version: 1.0
9aaaf6c
Content-Type: text/plain; charset=UTF-8
9aaaf6c
Content-Transfer-Encoding: 8bit
9aaaf6c
------------
9aaaf6c
9aaaf6c
Patch 7.3.221
9aaaf6c
Problem:    Text from the clipboard is sometimes handled as linewise, but not
9aaaf6c
            consistently.
9aaaf6c
Solution:   Assume the text is linewise when it ends in a CR or NL.
9aaaf6c
Files:      src/gui_gtk_x11.c, src/gui_mac.c, src/ops.c, src/os_msdos.c,
9aaaf6c
            src/os_mswin.c, src/os_qnx.c, src/ui.c
9aaaf6c
9aaaf6c
9aaaf6c
*** ../mercurial/vim73/src/gui_gtk_x11.c	2011-02-25 17:10:22.000000000 +0100
9aaaf6c
--- src/gui_gtk_x11.c	2011-06-19 00:58:31.000000000 +0200
9aaaf6c
***************
9aaaf6c
*** 1173,1179 ****
9aaaf6c
      char_u	    *tmpbuf = NULL;
9aaaf6c
      guchar	    *tmpbuf_utf8 = NULL;
9aaaf6c
      int		    len;
9aaaf6c
!     int		    motion_type;
9aaaf6c
  
9aaaf6c
      if (data->selection == clip_plus.gtk_sel_atom)
9aaaf6c
  	cbd = &clip_plus;
9aaaf6c
--- 1173,1179 ----
9aaaf6c
      char_u	    *tmpbuf = NULL;
9aaaf6c
      guchar	    *tmpbuf_utf8 = NULL;
9aaaf6c
      int		    len;
9aaaf6c
!     int		    motion_type = MAUTO;
9aaaf6c
  
9aaaf6c
      if (data->selection == clip_plus.gtk_sel_atom)
9aaaf6c
  	cbd = &clip_plus;
9aaaf6c
***************
9aaaf6c
*** 1182,1188 ****
9aaaf6c
  
9aaaf6c
      text = (char_u *)data->data;
9aaaf6c
      len  = data->length;
9aaaf6c
-     motion_type = MCHAR;
9aaaf6c
  
9aaaf6c
      if (text == NULL || len <= 0)
9aaaf6c
      {
9aaaf6c
--- 1182,1187 ----
9aaaf6c
*** ../mercurial/vim73/src/gui_mac.c	2011-06-12 20:33:30.000000000 +0200
9aaaf6c
--- src/gui_mac.c	2011-06-19 00:59:07.000000000 +0200
9aaaf6c
***************
9aaaf6c
*** 4671,4677 ****
9aaaf6c
      if (flavor)
9aaaf6c
  	type = **textOfClip;
9aaaf6c
      else
9aaaf6c
! 	type = (strchr(*textOfClip, '\r') != NULL) ? MLINE : MCHAR;
9aaaf6c
  
9aaaf6c
      tempclip = lalloc(scrapSize + 1, TRUE);
9aaaf6c
      mch_memmove(tempclip, *textOfClip + flavor, scrapSize);
9aaaf6c
--- 4671,4677 ----
9aaaf6c
      if (flavor)
9aaaf6c
  	type = **textOfClip;
9aaaf6c
      else
9aaaf6c
! 	type = MAUTO;
9aaaf6c
  
9aaaf6c
      tempclip = lalloc(scrapSize + 1, TRUE);
9aaaf6c
      mch_memmove(tempclip, *textOfClip + flavor, scrapSize);
9aaaf6c
*** ../mercurial/vim73/src/ops.c	2011-04-01 16:28:33.000000000 +0200
9aaaf6c
--- src/ops.c	2011-06-19 00:59:39.000000000 +0200
9aaaf6c
***************
9aaaf6c
*** 5733,5739 ****
9aaaf6c
      }
9aaaf6c
  }
9aaaf6c
  
9aaaf6c
! /* Convert from the GUI selection string into the '*'/'+' register */
9aaaf6c
      void
9aaaf6c
  clip_yank_selection(type, str, len, cbd)
9aaaf6c
      int		type;
9aaaf6c
--- 5733,5741 ----
9aaaf6c
      }
9aaaf6c
  }
9aaaf6c
  
9aaaf6c
! /*
9aaaf6c
!  * Convert from the GUI selection string into the '*'/'+' register.
9aaaf6c
!  */
9aaaf6c
      void
9aaaf6c
  clip_yank_selection(type, str, len, cbd)
9aaaf6c
      int		type;
9aaaf6c
***************
9aaaf6c
*** 6090,6098 ****
9aaaf6c
      if (yank_type == MBLOCK)
9aaaf6c
  	yank_type = MAUTO;
9aaaf6c
  #endif
9aaaf6c
-     if (yank_type == MAUTO)
9aaaf6c
- 	yank_type = ((len > 0 && (str[len - 1] == '\n' || str[len - 1] == '\r'))
9aaaf6c
- 							     ? MLINE : MCHAR);
9aaaf6c
      str_to_reg(y_current, yank_type, str, len, block_len);
9aaaf6c
  
9aaaf6c
  # ifdef FEAT_CLIPBOARD
9aaaf6c
--- 6092,6097 ----
9aaaf6c
***************
9aaaf6c
*** 6113,6125 ****
9aaaf6c
   * is appended.
9aaaf6c
   */
9aaaf6c
      static void
9aaaf6c
! str_to_reg(y_ptr, type, str, len, blocklen)
9aaaf6c
      struct yankreg	*y_ptr;		/* pointer to yank register */
9aaaf6c
!     int			type;		/* MCHAR, MLINE or MBLOCK */
9aaaf6c
      char_u		*str;		/* string to put in register */
9aaaf6c
      long		len;		/* length of string */
9aaaf6c
      long		blocklen;	/* width of Visual block */
9aaaf6c
  {
9aaaf6c
      int		lnum;
9aaaf6c
      long	start;
9aaaf6c
      long	i;
9aaaf6c
--- 6112,6125 ----
9aaaf6c
   * is appended.
9aaaf6c
   */
9aaaf6c
      static void
9aaaf6c
! str_to_reg(y_ptr, yank_type, str, len, blocklen)
9aaaf6c
      struct yankreg	*y_ptr;		/* pointer to yank register */
9aaaf6c
!     int			yank_type;	/* MCHAR, MLINE, MBLOCK, MAUTO */
9aaaf6c
      char_u		*str;		/* string to put in register */
9aaaf6c
      long		len;		/* length of string */
9aaaf6c
      long		blocklen;	/* width of Visual block */
9aaaf6c
  {
9aaaf6c
+     int		type;			/* MCHAR, MLINE or MBLOCK */
9aaaf6c
      int		lnum;
9aaaf6c
      long	start;
9aaaf6c
      long	i;
9aaaf6c
***************
9aaaf6c
*** 6136,6141 ****
9aaaf6c
--- 6136,6147 ----
9aaaf6c
      if (y_ptr->y_array == NULL)		/* NULL means empty register */
9aaaf6c
  	y_ptr->y_size = 0;
9aaaf6c
  
9aaaf6c
+     if (yank_type == MAUTO)
9aaaf6c
+ 	type = ((len > 0 && (str[len - 1] == NL || str[len - 1] == CAR))
9aaaf6c
+ 							     ? MLINE : MCHAR);
9aaaf6c
+     else
9aaaf6c
+ 	type = yank_type;
9aaaf6c
+ 
9aaaf6c
      /*
9aaaf6c
       * Count the number of lines within the string
9aaaf6c
       */
9aaaf6c
*** ../mercurial/vim73/src/os_msdos.c	2010-12-17 18:06:00.000000000 +0100
9aaaf6c
--- src/os_msdos.c	2011-06-19 01:00:56.000000000 +0200
9aaaf6c
***************
9aaaf6c
*** 2232,2238 ****
9aaaf6c
      void
9aaaf6c
  clip_mch_request_selection(VimClipboard *cbd)
9aaaf6c
  {
9aaaf6c
!     int		type = MCHAR;
9aaaf6c
      char_u	*pAllocated = NULL;
9aaaf6c
      char_u	*pClipText = NULL;
9aaaf6c
      int		clip_data_format = 0;
9aaaf6c
--- 2232,2238 ----
9aaaf6c
      void
9aaaf6c
  clip_mch_request_selection(VimClipboard *cbd)
9aaaf6c
  {
9aaaf6c
!     int		type = MAUTO;
9aaaf6c
      char_u	*pAllocated = NULL;
9aaaf6c
      char_u	*pClipText = NULL;
9aaaf6c
      int		clip_data_format = 0;
9aaaf6c
***************
9aaaf6c
*** 2280,2293 ****
9aaaf6c
  	{
9aaaf6c
  	    clip_data_format = CF_TEXT;
9aaaf6c
  	    pClipText = pAllocated;
9aaaf6c
- 	    type = (vim_strchr((char*)pClipText, '\r') != NULL) ? MLINE : MCHAR;
9aaaf6c
  	}
9aaaf6c
  
9aaaf6c
  	else if ((pAllocated = Win16GetClipboardData(CF_OEMTEXT)) != NULL)
9aaaf6c
  	{
9aaaf6c
  	    clip_data_format = CF_OEMTEXT;
9aaaf6c
  	    pClipText = pAllocated;
9aaaf6c
- 	    type = (vim_strchr((char*)pClipText, '\r') != NULL) ? MLINE : MCHAR;
9aaaf6c
  	}
9aaaf6c
  
9aaaf6c
  	/* Did we get anything? */
9aaaf6c
--- 2280,2291 ----
9aaaf6c
*** ../mercurial/vim73/src/os_mswin.c	2011-01-17 20:08:04.000000000 +0100
9aaaf6c
--- src/os_mswin.c	2011-06-19 01:01:51.000000000 +0200
9aaaf6c
***************
9aaaf6c
*** 1410,1418 ****
9aaaf6c
      {
9aaaf6c
  	char_u *temp_clipboard;
9aaaf6c
  
9aaaf6c
! 	/* If the type is not known guess it. */
9aaaf6c
  	if (metadata.type == -1)
9aaaf6c
! 	    metadata.type = (vim_strchr(str, '\n') == NULL) ? MCHAR : MLINE;
9aaaf6c
  
9aaaf6c
  	/* Translate <CR><NL> into <NL>. */
9aaaf6c
  	temp_clipboard = crnl_to_nl(str, &str_size);
9aaaf6c
--- 1410,1418 ----
9aaaf6c
      {
9aaaf6c
  	char_u *temp_clipboard;
9aaaf6c
  
9aaaf6c
! 	/* If the type is not known detect it. */
9aaaf6c
  	if (metadata.type == -1)
9aaaf6c
! 	    metadata.type = MAUTO;
9aaaf6c
  
9aaaf6c
  	/* Translate <CR><NL> into <NL>. */
9aaaf6c
  	temp_clipboard = crnl_to_nl(str, &str_size);
9aaaf6c
*** ../mercurial/vim73/src/os_qnx.c	2010-05-15 21:22:11.000000000 +0200
9aaaf6c
--- src/os_qnx.c	2011-06-19 01:02:26.000000000 +0200
9aaaf6c
***************
9aaaf6c
*** 93,99 ****
9aaaf6c
  	    clip_length  = clip_header->length - 1;
9aaaf6c
  
9aaaf6c
  	    if( clip_text != NULL && is_type_set == FALSE )
9aaaf6c
! 		type = (strchr( clip_text, '\r' ) != NULL) ? MLINE : MCHAR;
9aaaf6c
  	}
9aaaf6c
  
9aaaf6c
  	if( (clip_text != NULL) && (clip_length > 0) )
9aaaf6c
--- 93,99 ----
9aaaf6c
  	    clip_length  = clip_header->length - 1;
9aaaf6c
  
9aaaf6c
  	    if( clip_text != NULL && is_type_set == FALSE )
9aaaf6c
! 		type = MAUTO;
9aaaf6c
  	}
9aaaf6c
  
9aaaf6c
  	if( (clip_text != NULL) && (clip_length > 0) )
9aaaf6c
*** ../mercurial/vim73/src/ui.c	2010-09-21 22:09:28.000000000 +0200
9aaaf6c
--- src/ui.c	2011-06-19 01:03:31.000000000 +0200
9aaaf6c
***************
9aaaf6c
*** 1609,1615 ****
9aaaf6c
  
9aaaf6c
  #if defined(FEAT_HANGULIN) || defined(PROTO)
9aaaf6c
      void
9aaaf6c
! push_raw_key (s, len)
9aaaf6c
      char_u  *s;
9aaaf6c
      int	    len;
9aaaf6c
  {
9aaaf6c
--- 1609,1615 ----
9aaaf6c
  
9aaaf6c
  #if defined(FEAT_HANGULIN) || defined(PROTO)
9aaaf6c
      void
9aaaf6c
! push_raw_key(s, len)
9aaaf6c
      char_u  *s;
9aaaf6c
      int	    len;
9aaaf6c
  {
9aaaf6c
***************
9aaaf6c
*** 2016,2022 ****
9aaaf6c
      long_u	*length;
9aaaf6c
      int		*format;
9aaaf6c
  {
9aaaf6c
!     int		motion_type;
9aaaf6c
      long_u	len;
9aaaf6c
      char_u	*p;
9aaaf6c
      char	**text_list = NULL;
9aaaf6c
--- 2016,2022 ----
9aaaf6c
      long_u	*length;
9aaaf6c
      int		*format;
9aaaf6c
  {
9aaaf6c
!     int		motion_type = MAUTO;
9aaaf6c
      long_u	len;
9aaaf6c
      char_u	*p;
9aaaf6c
      char	**text_list = NULL;
9aaaf6c
***************
9aaaf6c
*** 2036,2042 ****
9aaaf6c
  	*(int *)success = FALSE;
9aaaf6c
  	return;
9aaaf6c
      }
9aaaf6c
-     motion_type = MCHAR;
9aaaf6c
      p = (char_u *)value;
9aaaf6c
      len = *length;
9aaaf6c
      if (*type == vim_atom)
9aaaf6c
--- 2036,2041 ----
9aaaf6c
*** ../vim-7.3.220/src/version.c	2011-06-19 00:27:46.000000000 +0200
9aaaf6c
--- src/version.c	2011-06-19 01:03:59.000000000 +0200
9aaaf6c
***************
9aaaf6c
*** 711,712 ****
9aaaf6c
--- 711,714 ----
9aaaf6c
  {   /* Add new patch number below this line */
9aaaf6c
+ /**/
9aaaf6c
+     221,
9aaaf6c
  /**/
9aaaf6c
9aaaf6c
-- 
9aaaf6c
hundred-and-one symptoms of being an internet addict:
9aaaf6c
190. You quickly hand over your wallet, leather jacket, and car keys
9aaaf6c
     during a mugging, then proceed to beat the crap out of your
9aaaf6c
     assailant when he asks for your laptop.
9aaaf6c
9aaaf6c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
9aaaf6c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
9aaaf6c
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
9aaaf6c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///