1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Text from the clipboard is sometimes handled as linewise, but not
13 Solution: Assume the text is linewise when it ends in a CR or NL.
14 Files: src/gui_gtk_x11.c, src/gui_mac.c, src/ops.c, src/os_msdos.c,
15 src/os_mswin.c, src/os_qnx.c, src/ui.c
18 *** ../mercurial/vim73/src/gui_gtk_x11.c 2011-02-25 17:10:22.000000000 +0100
19 --- src/gui_gtk_x11.c 2011-06-19 00:58:31.000000000 +0200
22 char_u *tmpbuf = NULL;
23 guchar *tmpbuf_utf8 = NULL;
27 if (data->selection == clip_plus.gtk_sel_atom)
30 char_u *tmpbuf = NULL;
31 guchar *tmpbuf_utf8 = NULL;
33 ! int motion_type = MAUTO;
35 if (data->selection == clip_plus.gtk_sel_atom)
40 text = (char_u *)data->data;
42 - motion_type = MCHAR;
44 if (text == NULL || len <= 0)
47 *** ../mercurial/vim73/src/gui_mac.c 2011-06-12 20:33:30.000000000 +0200
48 --- src/gui_mac.c 2011-06-19 00:59:07.000000000 +0200
54 ! type = (strchr(*textOfClip, '\r') != NULL) ? MLINE : MCHAR;
56 tempclip = lalloc(scrapSize + 1, TRUE);
57 mch_memmove(tempclip, *textOfClip + flavor, scrapSize);
64 tempclip = lalloc(scrapSize + 1, TRUE);
65 mch_memmove(tempclip, *textOfClip + flavor, scrapSize);
66 *** ../mercurial/vim73/src/ops.c 2011-04-01 16:28:33.000000000 +0200
67 --- src/ops.c 2011-06-19 00:59:39.000000000 +0200
73 ! /* Convert from the GUI selection string into the '*'/'+' register */
75 clip_yank_selection(type, str, len, cbd)
82 ! * Convert from the GUI selection string into the '*'/'+' register.
85 clip_yank_selection(type, str, len, cbd)
89 if (yank_type == MBLOCK)
92 - if (yank_type == MAUTO)
93 - yank_type = ((len > 0 && (str[len - 1] == '\n' || str[len - 1] == '\r'))
95 str_to_reg(y_current, yank_type, str, len, block_len);
97 # ifdef FEAT_CLIPBOARD
104 ! str_to_reg(y_ptr, type, str, len, blocklen)
105 struct yankreg *y_ptr; /* pointer to yank register */
106 ! int type; /* MCHAR, MLINE or MBLOCK */
107 char_u *str; /* string to put in register */
108 long len; /* length of string */
109 long blocklen; /* width of Visual block */
118 ! str_to_reg(y_ptr, yank_type, str, len, blocklen)
119 struct yankreg *y_ptr; /* pointer to yank register */
120 ! int yank_type; /* MCHAR, MLINE, MBLOCK, MAUTO */
121 char_u *str; /* string to put in register */
122 long len; /* length of string */
123 long blocklen; /* width of Visual block */
125 + int type; /* MCHAR, MLINE or MBLOCK */
132 if (y_ptr->y_array == NULL) /* NULL means empty register */
135 + if (yank_type == MAUTO)
136 + type = ((len > 0 && (str[len - 1] == NL || str[len - 1] == CAR))
142 * Count the number of lines within the string
144 *** ../mercurial/vim73/src/os_msdos.c 2010-12-17 18:06:00.000000000 +0100
145 --- src/os_msdos.c 2011-06-19 01:00:56.000000000 +0200
149 clip_mch_request_selection(VimClipboard *cbd)
152 char_u *pAllocated = NULL;
153 char_u *pClipText = NULL;
154 int clip_data_format = 0;
157 clip_mch_request_selection(VimClipboard *cbd)
160 char_u *pAllocated = NULL;
161 char_u *pClipText = NULL;
162 int clip_data_format = 0;
166 clip_data_format = CF_TEXT;
167 pClipText = pAllocated;
168 - type = (vim_strchr((char*)pClipText, '\r') != NULL) ? MLINE : MCHAR;
171 else if ((pAllocated = Win16GetClipboardData(CF_OEMTEXT)) != NULL)
173 clip_data_format = CF_OEMTEXT;
174 pClipText = pAllocated;
175 - type = (vim_strchr((char*)pClipText, '\r') != NULL) ? MLINE : MCHAR;
178 /* Did we get anything? */
180 *** ../mercurial/vim73/src/os_mswin.c 2011-01-17 20:08:04.000000000 +0100
181 --- src/os_mswin.c 2011-06-19 01:01:51.000000000 +0200
185 char_u *temp_clipboard;
187 ! /* If the type is not known guess it. */
188 if (metadata.type == -1)
189 ! metadata.type = (vim_strchr(str, '\n') == NULL) ? MCHAR : MLINE;
191 /* Translate <CR><NL> into <NL>. */
192 temp_clipboard = crnl_to_nl(str, &str_size);
195 char_u *temp_clipboard;
197 ! /* If the type is not known detect it. */
198 if (metadata.type == -1)
199 ! metadata.type = MAUTO;
201 /* Translate <CR><NL> into <NL>. */
202 temp_clipboard = crnl_to_nl(str, &str_size);
203 *** ../mercurial/vim73/src/os_qnx.c 2010-05-15 21:22:11.000000000 +0200
204 --- src/os_qnx.c 2011-06-19 01:02:26.000000000 +0200
207 clip_length = clip_header->length - 1;
209 if( clip_text != NULL && is_type_set == FALSE )
210 ! type = (strchr( clip_text, '\r' ) != NULL) ? MLINE : MCHAR;
213 if( (clip_text != NULL) && (clip_length > 0) )
215 clip_length = clip_header->length - 1;
217 if( clip_text != NULL && is_type_set == FALSE )
221 if( (clip_text != NULL) && (clip_length > 0) )
222 *** ../mercurial/vim73/src/ui.c 2010-09-21 22:09:28.000000000 +0200
223 --- src/ui.c 2011-06-19 01:03:31.000000000 +0200
227 #if defined(FEAT_HANGULIN) || defined(PROTO)
229 ! push_raw_key (s, len)
235 #if defined(FEAT_HANGULIN) || defined(PROTO)
237 ! push_raw_key(s, len)
249 char **text_list = NULL;
254 ! int motion_type = MAUTO;
257 char **text_list = NULL;
260 *(int *)success = FALSE;
263 - motion_type = MCHAR;
266 if (*type == vim_atom)
268 *** ../vim-7.3.220/src/version.c 2011-06-19 00:27:46.000000000 +0200
269 --- src/version.c 2011-06-19 01:03:59.000000000 +0200
273 { /* Add new patch number below this line */
279 hundred-and-one symptoms of being an internet addict:
280 190. You quickly hand over your wallet, leather jacket, and car keys
281 during a mugging, then proceed to beat the crap out of your
282 assailant when he asks for your laptop.
284 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
285 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
286 \\\ an exciting new programming language -- http://www.Zimbu.org ///
287 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///