summaryrefslogtreecommitdiff
path: root/source/ap/vim/patches/7.2.017
diff options
context:
space:
mode:
Diffstat (limited to 'source/ap/vim/patches/7.2.017')
-rw-r--r--source/ap/vim/patches/7.2.017162
1 files changed, 162 insertions, 0 deletions
diff --git a/source/ap/vim/patches/7.2.017 b/source/ap/vim/patches/7.2.017
new file mode 100644
index 00000000..99979a15
--- /dev/null
+++ b/source/ap/vim/patches/7.2.017
@@ -0,0 +1,162 @@
+To: vim-dev@vim.org
+Subject: Patch 7.2.017
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 7.2.017
+Problem: strlen() used on text that may not end in a NUL. (Dominique Pelle)
+ Pasting a very big selection doesn't work.
+Solution: Use the length passed to the XtSelectionCallbackProc() function.
+ After getting the SelectionNotify event continue dispatching
+ events until the callback is actually called. Also dispatch the
+ PropertyNotify event.
+Files: src/ui.c
+
+
+*** ../vim-7.2.016/src/ui.c Sun Sep 7 21:47:51 2008
+--- src/ui.c Sun Sep 14 15:52:19 2008
+***************
+*** 2020,2026 ****
+
+ if (value == NULL || *length == 0)
+ {
+! clip_free_selection(cbd); /* ??? [what's the query?] */
+ *(int *)success = FALSE;
+ return;
+ }
+--- 2020,2026 ----
+
+ if (value == NULL || *length == 0)
+ {
+! clip_free_selection(cbd); /* nothing received, clear register */
+ *(int *)success = FALSE;
+ return;
+ }
+***************
+*** 2076,2082 ****
+ text_prop.value = (unsigned char *)value;
+ text_prop.encoding = *type;
+ text_prop.format = *format;
+! text_prop.nitems = STRLEN(value);
+ status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
+ &text_list, &n_text);
+ if (status != Success || n_text < 1)
+--- 2076,2082 ----
+ text_prop.value = (unsigned char *)value;
+ text_prop.encoding = *type;
+ text_prop.format = *format;
+! text_prop.nitems = len;
+ status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
+ &text_list, &n_text);
+ if (status != Success || n_text < 1)
+***************
+*** 2131,2137 ****
+ case 3: type = text_atom; break;
+ default: type = XA_STRING;
+ }
+! success = FALSE;
+ XtGetSelectionValue(myShell, cbd->sel_atom, type,
+ clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
+
+--- 2131,2137 ----
+ case 3: type = text_atom; break;
+ default: type = XA_STRING;
+ }
+! success = MAYBE;
+ XtGetSelectionValue(myShell, cbd->sel_atom, type,
+ clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
+
+***************
+*** 2145,2169 ****
+ * paste! Don't worry, we will catch up with any other events later.
+ */
+ start_time = time(NULL);
+! for (;;)
+ {
+! if (XCheckTypedEvent(dpy, SelectionNotify, &event))
+ {
+! /* this is where clip_x11_request_selection_cb() is actually
+! * called */
+ XtDispatchEvent(&event);
+! break;
+ }
+- if (XCheckTypedEvent(dpy, SelectionRequest, &event))
+- /* We may get a SelectionRequest here and if we don't handle
+- * it we hang. KDE klipper does this, for example. */
+- XtDispatchEvent(&event);
+
+ /* Time out after 2 to 3 seconds to avoid that we hang when the
+ * other process doesn't respond. Note that the SelectionNotify
+ * event may still come later when the selection owner comes back
+! * to life and the text gets inserted unexpectedly (by xterm).
+! * Don't know how to avoid that :-(. */
+ if (time(NULL) > start_time + 2)
+ {
+ timed_out = TRUE;
+--- 2145,2171 ----
+ * paste! Don't worry, we will catch up with any other events later.
+ */
+ start_time = time(NULL);
+! while (success == MAYBE)
+ {
+! if (XCheckTypedEvent(dpy, SelectionNotify, &event)
+! || XCheckTypedEvent(dpy, SelectionRequest, &event)
+! || XCheckTypedEvent(dpy, PropertyNotify, &event))
+ {
+! /* This is where clip_x11_request_selection_cb() should be
+! * called. It may actually happen a bit later, so we loop
+! * until "success" changes.
+! * We may get a SelectionRequest here and if we don't handle
+! * it we hang. KDE klipper does this, for example.
+! * We need to handle a PropertyNotify for large selections. */
+ XtDispatchEvent(&event);
+! continue;
+ }
+
+ /* Time out after 2 to 3 seconds to avoid that we hang when the
+ * other process doesn't respond. Note that the SelectionNotify
+ * event may still come later when the selection owner comes back
+! * to life and the text gets inserted unexpectedly. Don't know
+! * why that happens or how to avoid that :-(. */
+ if (time(NULL) > start_time + 2)
+ {
+ timed_out = TRUE;
+***************
+*** 2177,2183 ****
+ ui_delay(1L, TRUE);
+ }
+
+! if (success)
+ return;
+
+ /* don't do a retry with another type after timing out, otherwise we
+--- 2179,2185 ----
+ ui_delay(1L, TRUE);
+ }
+
+! if (success == TRUE)
+ return;
+
+ /* don't do a retry with another type after timing out, otherwise we
+*** ../vim-7.2.016/src/version.c Sun Sep 14 14:41:44 2008
+--- src/version.c Sun Sep 14 15:55:34 2008
+***************
+*** 678,679 ****
+--- 678,681 ----
+ { /* Add new patch number below this line */
++ /**/
++ 17,
+ /**/
+
+--
+hundred-and-one symptoms of being an internet addict:
+54. You start tilting your head sideways to smile. :-)
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
+/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\ download, build and distribute -- http://www.A-A-P.org ///
+ \\\ help me help AIDS victims -- http://ICCF-Holland.org ///