On Jun 19, 1:15 am, Bram Moolenaar wrote:
> Patch 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.
> Files:      src/gui_gtk_x11.c, src/gui_mac.c, src/ops.c, src/os_msdos.c,
>             src/os_mswin.c, src/os_qnx.c, src/ui.c
>

It seems Mac OS X was left out.  The patch below takes care of this.

Björn


---
 src/os_macosx.m |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/os_macosx.m b/src/os_macosx.m
index bc64667..5dbe2d4 100644
--- a/src/os_macosx.m
+++ b/src/os_macosx.m
@@ -65,7 +65,7 @@ clip_mch_request_selection(VimClipboard *cbd)
     NSString *bestType = [pb availableTypeFromArray:supportedTypes];
     if (!bestType) goto releasepool;

-    int motion_type = MCHAR;
+    int motion_type = MAUTO;
     NSString *string = nil;

     if ([bestType isEqual:VimPboardType])
@@ -89,9 +89,7 @@ clip_mch_request_selection(VimClipboard *cbd)

     if (!string)
     {
-       /* Use NSStringPboardType.  The motion type is set to line-wise if
the
-        * string contains at least one EOL character, otherwise it is set
to
-        * character-wise (block-wise is never used).
+       /* Use NSStringPboardType.  The motion type is detected
automatically.
         */
        NSMutableString *mstring =
                [[pb stringForType:NSStringPboardType] mutableCopy];
@@ -108,19 +106,12 @@ clip_mch_request_selection(VimClipboard *cbd)
                                           options:0 range:range];
        }

-       /* Scan for newline character to decide whether the string should be
-        * pasted line-wise or character-wise.
-        */
-       motion_type = MCHAR;
-       if (0 < n || NSNotFound != [mstring rangeOfString:@"\n"].location)
-           motion_type = MLINE;
-
        string = mstring;
     }

     if (!(MCHAR == motion_type || MLINE == motion_type || MBLOCK ==
motion_type
            || MAUTO == motion_type))
-       motion_type = MCHAR;
+       motion_type = MAUTO;

     char_u *str = (char_u*)[string UTF8String];
     int len = [string
lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
--

-- 
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

Raspunde prin e-mail lui