Hello,

Currently, when `putting' from the "* and "+ registers, the register is
always pasted as MCHAR if it has been returned from the X clipboard.

However, vim convention implies that any string that ends in a \n or \r
should be expected to be behave like a linewise yank (see MAUTO).

Since it is easy in most GUI programs to explicitly make linewise
selections (typically via triple-click), this small patch marks strings
requested from the X clipboard as MLINE if they end in a NL or CR
character.

This is a very cheap operation.

Cheers,
Sung Pae
---
 src/ui.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/ui.c b/src/ui.c
index 9d940b1..26688c8 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -2084,6 +2084,7 @@ clip_x11_request_selection_cb(w, success,
sel_atom, type, value, length,
        XTextProperty   text_prop;
        int             n_text = 0;
        int             status;
+       char_u          z;

        text_prop.value = (unsigned char *)value;
        text_prop.encoding = *type;
@@ -2098,6 +2099,11 @@ clip_x11_request_selection_cb(w, success,
sel_atom, type, value, length,
        }
        p = (char_u *)text_list[0];
        len = STRLEN(p);
+
+       /* This may be a linewise selection */
+       z = p[len - 1];
+       if (z == '\n' || z == '\r')
+           motion_type = MLINE;
     }
     clip_yank_selection(motion_type, p, (long)len, cbd);

--
1.7.5-rc0

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

Attachment: 0001-External-linewise-selections-from-X-clipboard.patch
Description: Binary data

Raspunde prin e-mail lui