mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
updated for version 7.2-017
This commit is contained in:
32
src/ui.c
32
src/ui.c
@@ -2020,7 +2020,7 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
|
||||
|
||||
if (value == NULL || *length == 0)
|
||||
{
|
||||
clip_free_selection(cbd); /* ??? [what's the query?] */
|
||||
clip_free_selection(cbd); /* nothing received, clear register */
|
||||
*(int *)success = FALSE;
|
||||
return;
|
||||
}
|
||||
@@ -2076,7 +2076,7 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
|
||||
text_prop.value = (unsigned char *)value;
|
||||
text_prop.encoding = *type;
|
||||
text_prop.format = *format;
|
||||
text_prop.nitems = STRLEN(value);
|
||||
text_prop.nitems = len;
|
||||
status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
|
||||
&text_list, &n_text);
|
||||
if (status != Success || n_text < 1)
|
||||
@@ -2131,7 +2131,7 @@ clip_x11_request_selection(myShell, dpy, cbd)
|
||||
case 3: type = text_atom; break;
|
||||
default: type = XA_STRING;
|
||||
}
|
||||
success = FALSE;
|
||||
success = MAYBE;
|
||||
XtGetSelectionValue(myShell, cbd->sel_atom, type,
|
||||
clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
|
||||
|
||||
@@ -2145,25 +2145,27 @@ clip_x11_request_selection(myShell, dpy, cbd)
|
||||
* paste! Don't worry, we will catch up with any other events later.
|
||||
*/
|
||||
start_time = time(NULL);
|
||||
for (;;)
|
||||
while (success == MAYBE)
|
||||
{
|
||||
if (XCheckTypedEvent(dpy, SelectionNotify, &event))
|
||||
if (XCheckTypedEvent(dpy, SelectionNotify, &event)
|
||||
|| XCheckTypedEvent(dpy, SelectionRequest, &event)
|
||||
|| XCheckTypedEvent(dpy, PropertyNotify, &event))
|
||||
{
|
||||
/* this is where clip_x11_request_selection_cb() is actually
|
||||
* called */
|
||||
/* 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);
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
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 :-(. */
|
||||
* 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,7 +2179,7 @@ clip_x11_request_selection(myShell, dpy, cbd)
|
||||
ui_delay(1L, TRUE);
|
||||
}
|
||||
|
||||
if (success)
|
||||
if (success == TRUE)
|
||||
return;
|
||||
|
||||
/* don't do a retry with another type after timing out, otherwise we
|
||||
|
@@ -676,6 +676,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
17,
|
||||
/**/
|
||||
16,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user