]> git.pld-linux.org Git - packages/vim.git/blame - 7.2.017
- updated to 7.2.102
[packages/vim.git] / 7.2.017
CommitLineData
b02c59fe
ER
1To: vim-dev@vim.org
2Subject: Patch 7.2.017
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=ISO-8859-1
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.2.017
11Problem: strlen() used on text that may not end in a NUL. (Dominique Pelle)
12 Pasting a very big selection doesn't work.
13Solution: Use the length passed to the XtSelectionCallbackProc() function.
14 After getting the SelectionNotify event continue dispatching
15 events until the callback is actually called. Also dispatch the
16 PropertyNotify event.
17Files: src/ui.c
18
19
20*** ../vim-7.2.016/src/ui.c Sun Sep 7 21:47:51 2008
21--- src/ui.c Sun Sep 14 15:52:19 2008
22***************
23*** 2020,2026 ****
24
25 if (value == NULL || *length == 0)
26 {
27! clip_free_selection(cbd); /* ??? [what's the query?] */
28 *(int *)success = FALSE;
29 return;
30 }
31--- 2020,2026 ----
32
33 if (value == NULL || *length == 0)
34 {
35! clip_free_selection(cbd); /* nothing received, clear register */
36 *(int *)success = FALSE;
37 return;
38 }
39***************
40*** 2076,2082 ****
41 text_prop.value = (unsigned char *)value;
42 text_prop.encoding = *type;
43 text_prop.format = *format;
44! text_prop.nitems = STRLEN(value);
45 status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
46 &text_list, &n_text);
47 if (status != Success || n_text < 1)
48--- 2076,2082 ----
49 text_prop.value = (unsigned char *)value;
50 text_prop.encoding = *type;
51 text_prop.format = *format;
52! text_prop.nitems = len;
53 status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
54 &text_list, &n_text);
55 if (status != Success || n_text < 1)
56***************
57*** 2131,2137 ****
58 case 3: type = text_atom; break;
59 default: type = XA_STRING;
60 }
61! success = FALSE;
62 XtGetSelectionValue(myShell, cbd->sel_atom, type,
63 clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
64
65--- 2131,2137 ----
66 case 3: type = text_atom; break;
67 default: type = XA_STRING;
68 }
69! success = MAYBE;
70 XtGetSelectionValue(myShell, cbd->sel_atom, type,
71 clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
72
73***************
74*** 2145,2169 ****
75 * paste! Don't worry, we will catch up with any other events later.
76 */
77 start_time = time(NULL);
78! for (;;)
79 {
80! if (XCheckTypedEvent(dpy, SelectionNotify, &event))
81 {
82! /* this is where clip_x11_request_selection_cb() is actually
83! * called */
84 XtDispatchEvent(&event);
85! break;
86 }
87- if (XCheckTypedEvent(dpy, SelectionRequest, &event))
88- /* We may get a SelectionRequest here and if we don't handle
89- * it we hang. KDE klipper does this, for example. */
90- XtDispatchEvent(&event);
91
92 /* Time out after 2 to 3 seconds to avoid that we hang when the
93 * other process doesn't respond. Note that the SelectionNotify
94 * event may still come later when the selection owner comes back
95! * to life and the text gets inserted unexpectedly (by xterm).
96! * Don't know how to avoid that :-(. */
97 if (time(NULL) > start_time + 2)
98 {
99 timed_out = TRUE;
100--- 2145,2171 ----
101 * paste! Don't worry, we will catch up with any other events later.
102 */
103 start_time = time(NULL);
104! while (success == MAYBE)
105 {
106! if (XCheckTypedEvent(dpy, SelectionNotify, &event)
107! || XCheckTypedEvent(dpy, SelectionRequest, &event)
108! || XCheckTypedEvent(dpy, PropertyNotify, &event))
109 {
110! /* This is where clip_x11_request_selection_cb() should be
111! * called. It may actually happen a bit later, so we loop
112! * until "success" changes.
113! * We may get a SelectionRequest here and if we don't handle
114! * it we hang. KDE klipper does this, for example.
115! * We need to handle a PropertyNotify for large selections. */
116 XtDispatchEvent(&event);
117! continue;
118 }
119
120 /* Time out after 2 to 3 seconds to avoid that we hang when the
121 * other process doesn't respond. Note that the SelectionNotify
122 * event may still come later when the selection owner comes back
123! * to life and the text gets inserted unexpectedly. Don't know
124! * why that happens or how to avoid that :-(. */
125 if (time(NULL) > start_time + 2)
126 {
127 timed_out = TRUE;
128***************
129*** 2177,2183 ****
130 ui_delay(1L, TRUE);
131 }
132
133! if (success)
134 return;
135
136 /* don't do a retry with another type after timing out, otherwise we
137--- 2179,2185 ----
138 ui_delay(1L, TRUE);
139 }
140
141! if (success == TRUE)
142 return;
143
144 /* don't do a retry with another type after timing out, otherwise we
145*** ../vim-7.2.016/src/version.c Sun Sep 14 14:41:44 2008
146--- src/version.c Sun Sep 14 15:55:34 2008
147***************
148*** 678,679 ****
149--- 678,681 ----
150 { /* Add new patch number below this line */
151+ /**/
152+ 17,
153 /**/
154
155--
156hundred-and-one symptoms of being an internet addict:
15754. You start tilting your head sideways to smile. :-)
158
159 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
160/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
161\\\ download, build and distribute -- http://www.A-A-P.org ///
162 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
This page took 0.050715 seconds and 4 git commands to generate.