|
Karsten Hopp |
964446 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
964446 |
Subject: Patch 7.3.856
|
|
Karsten Hopp |
964446 |
Fcc: outbox
|
|
Karsten Hopp |
964446 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
964446 |
Mime-Version: 1.0
|
|
Karsten Hopp |
964446 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
964446 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
964446 |
------------
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
Patch 7.3.856
|
|
Karsten Hopp |
964446 |
Problem: When calling system() multi-byte clipboard contents is garbled.
|
|
Karsten Hopp |
964446 |
Solution: Save and restore the clipboard contents. (Yukihiro Nakadaira)
|
|
Karsten Hopp |
964446 |
Files: src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro, src/ops.c,
|
|
Karsten Hopp |
964446 |
src/proto/ops.pro, src/os_unix.c, src/proto/ui.pro, src/ui.c
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
*** ../vim-7.3.855/src/gui_gtk_x11.c 2013-02-14 22:11:31.000000000 +0100
|
|
Karsten Hopp |
964446 |
--- src/gui_gtk_x11.c 2013-03-13 17:28:00.000000000 +0100
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 5674,5685 ****
|
|
Karsten Hopp |
964446 |
void
|
|
Karsten Hopp |
964446 |
clip_mch_lose_selection(VimClipboard *cbd UNUSED)
|
|
Karsten Hopp |
964446 |
{
|
|
Karsten Hopp |
964446 |
! /* WEIRD: when using NULL to actually disown the selection, we lose the
|
|
Karsten Hopp |
964446 |
! * selection the first time we own it. */
|
|
Karsten Hopp |
964446 |
! /*
|
|
Karsten Hopp |
964446 |
! gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, (guint32)GDK_CURRENT_TIME);
|
|
Karsten Hopp |
964446 |
gui_mch_update();
|
|
Karsten Hopp |
964446 |
- */
|
|
Karsten Hopp |
964446 |
}
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
/*
|
|
Karsten Hopp |
964446 |
--- 5674,5681 ----
|
|
Karsten Hopp |
964446 |
void
|
|
Karsten Hopp |
964446 |
clip_mch_lose_selection(VimClipboard *cbd UNUSED)
|
|
Karsten Hopp |
964446 |
{
|
|
Karsten Hopp |
964446 |
! gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, gui.event_time);
|
|
Karsten Hopp |
964446 |
gui_mch_update();
|
|
Karsten Hopp |
964446 |
}
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
/*
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 5705,5710 ****
|
|
Karsten Hopp |
964446 |
--- 5701,5712 ----
|
|
Karsten Hopp |
964446 |
{
|
|
Karsten Hopp |
964446 |
}
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
+ int
|
|
Karsten Hopp |
964446 |
+ clip_gtk_owner_exists(VimClipboard *cbd)
|
|
Karsten Hopp |
964446 |
+ {
|
|
Karsten Hopp |
964446 |
+ return gdk_selection_owner_get(cbd->gtk_sel_atom) != NULL;
|
|
Karsten Hopp |
964446 |
+ }
|
|
Karsten Hopp |
964446 |
+
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
#if defined(FEAT_MENU) || defined(PROTO)
|
|
Karsten Hopp |
964446 |
/*
|
|
Karsten Hopp |
964446 |
*** ../vim-7.3.855/src/proto/gui_gtk_x11.pro 2012-05-18 17:03:14.000000000 +0200
|
|
Karsten Hopp |
964446 |
--- src/proto/gui_gtk_x11.pro 2013-03-13 17:35:17.000000000 +0100
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 59,64 ****
|
|
Karsten Hopp |
964446 |
--- 59,65 ----
|
|
Karsten Hopp |
964446 |
void clip_mch_lose_selection __ARGS((VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
int clip_mch_own_selection __ARGS((VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
void clip_mch_set_selection __ARGS((VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
+ int clip_gtk_owner_exists __ARGS((VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
void gui_mch_menu_grey __ARGS((vimmenu_T *menu, int grey));
|
|
Karsten Hopp |
964446 |
void gui_mch_menu_hidden __ARGS((vimmenu_T *menu, int hidden));
|
|
Karsten Hopp |
964446 |
void gui_mch_draw_menubar __ARGS((void));
|
|
Karsten Hopp |
964446 |
*** ../vim-7.3.855/src/ops.c 2013-03-07 18:50:52.000000000 +0100
|
|
Karsten Hopp |
964446 |
--- src/ops.c 2013-03-13 17:30:50.000000000 +0100
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 1017,1022 ****
|
|
Karsten Hopp |
964446 |
--- 1017,1035 ----
|
|
Karsten Hopp |
964446 |
may_set_selection();
|
|
Karsten Hopp |
964446 |
# endif
|
|
Karsten Hopp |
964446 |
}
|
|
Karsten Hopp |
964446 |
+
|
|
Karsten Hopp |
964446 |
+ void
|
|
Karsten Hopp |
964446 |
+ free_register(reg)
|
|
Karsten Hopp |
964446 |
+ void *reg;
|
|
Karsten Hopp |
964446 |
+ {
|
|
Karsten Hopp |
964446 |
+ struct yankreg tmp;
|
|
Karsten Hopp |
964446 |
+
|
|
Karsten Hopp |
964446 |
+ tmp = *y_current;
|
|
Karsten Hopp |
964446 |
+ *y_current = *(struct yankreg *)reg;
|
|
Karsten Hopp |
964446 |
+ free_yank_all();
|
|
Karsten Hopp |
964446 |
+ vim_free(reg);
|
|
Karsten Hopp |
964446 |
+ *y_current = tmp;
|
|
Karsten Hopp |
964446 |
+ }
|
|
Karsten Hopp |
964446 |
#endif
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
#if defined(FEAT_MOUSE) || defined(PROTO)
|
|
Karsten Hopp |
964446 |
*** ../vim-7.3.855/src/proto/ops.pro 2012-06-06 16:12:54.000000000 +0200
|
|
Karsten Hopp |
964446 |
--- src/proto/ops.pro 2013-03-13 17:35:04.000000000 +0100
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 15,20 ****
|
|
Karsten Hopp |
964446 |
--- 15,21 ----
|
|
Karsten Hopp |
964446 |
int may_get_selection __ARGS((int regname));
|
|
Karsten Hopp |
964446 |
void *get_register __ARGS((int name, int copy));
|
|
Karsten Hopp |
964446 |
void put_register __ARGS((int name, void *reg));
|
|
Karsten Hopp |
964446 |
+ void free_register __ARGS((void *reg));
|
|
Karsten Hopp |
964446 |
int yank_register_mline __ARGS((int regname));
|
|
Karsten Hopp |
964446 |
int do_record __ARGS((int c));
|
|
Karsten Hopp |
964446 |
int do_execreg __ARGS((int regname, int colon, int addcr, int silent));
|
|
Karsten Hopp |
964446 |
*** ../vim-7.3.855/src/os_unix.c 2013-02-26 14:56:24.000000000 +0100
|
|
Karsten Hopp |
964446 |
--- src/os_unix.c 2013-03-13 17:33:00.000000000 +0100
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 1138,1143 ****
|
|
Karsten Hopp |
964446 |
--- 1138,1148 ----
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
# if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
|
|
Karsten Hopp |
964446 |
static void loose_clipboard __ARGS((void));
|
|
Karsten Hopp |
964446 |
+ static void save_clipboard __ARGS((void));
|
|
Karsten Hopp |
964446 |
+ static void restore_clipboard __ARGS((void));
|
|
Karsten Hopp |
964446 |
+
|
|
Karsten Hopp |
964446 |
+ static void *clip_star_save = NULL;
|
|
Karsten Hopp |
964446 |
+ static void *clip_plus_save = NULL;
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
/*
|
|
Karsten Hopp |
964446 |
* Called when Vim is going to sleep or execute a shell command.
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 1158,1163 ****
|
|
Karsten Hopp |
964446 |
--- 1163,1204 ----
|
|
Karsten Hopp |
964446 |
XFlush(x11_display);
|
|
Karsten Hopp |
964446 |
}
|
|
Karsten Hopp |
964446 |
}
|
|
Karsten Hopp |
964446 |
+
|
|
Karsten Hopp |
964446 |
+ /*
|
|
Karsten Hopp |
964446 |
+ * Save clipboard text to restore later.
|
|
Karsten Hopp |
964446 |
+ */
|
|
Karsten Hopp |
964446 |
+ static void
|
|
Karsten Hopp |
964446 |
+ save_clipboard()
|
|
Karsten Hopp |
964446 |
+ {
|
|
Karsten Hopp |
964446 |
+ if (clip_star.owned)
|
|
Karsten Hopp |
964446 |
+ clip_star_save = get_register('*', TRUE);
|
|
Karsten Hopp |
964446 |
+ if (clip_plus.owned)
|
|
Karsten Hopp |
964446 |
+ clip_plus_save = get_register('+', TRUE);
|
|
Karsten Hopp |
964446 |
+ }
|
|
Karsten Hopp |
964446 |
+
|
|
Karsten Hopp |
964446 |
+ /*
|
|
Karsten Hopp |
964446 |
+ * Restore clipboard text if no one own the X selection.
|
|
Karsten Hopp |
964446 |
+ */
|
|
Karsten Hopp |
964446 |
+ static void
|
|
Karsten Hopp |
964446 |
+ restore_clipboard()
|
|
Karsten Hopp |
964446 |
+ {
|
|
Karsten Hopp |
964446 |
+ if (clip_star_save != NULL)
|
|
Karsten Hopp |
964446 |
+ {
|
|
Karsten Hopp |
964446 |
+ if (!clip_gen_owner_exists(&clip_star))
|
|
Karsten Hopp |
964446 |
+ put_register('*', clip_star_save);
|
|
Karsten Hopp |
964446 |
+ else
|
|
Karsten Hopp |
964446 |
+ free_register(clip_star_save);
|
|
Karsten Hopp |
964446 |
+ clip_star_save = NULL;
|
|
Karsten Hopp |
964446 |
+ }
|
|
Karsten Hopp |
964446 |
+ if (clip_plus_save != NULL)
|
|
Karsten Hopp |
964446 |
+ {
|
|
Karsten Hopp |
964446 |
+ if (!clip_gen_owner_exists(&clip_plus))
|
|
Karsten Hopp |
964446 |
+ put_register('+', clip_plus_save);
|
|
Karsten Hopp |
964446 |
+ else
|
|
Karsten Hopp |
964446 |
+ free_register(clip_plus_save);
|
|
Karsten Hopp |
964446 |
+ clip_plus_save = NULL;
|
|
Karsten Hopp |
964446 |
+ }
|
|
Karsten Hopp |
964446 |
+ }
|
|
Karsten Hopp |
964446 |
#endif
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
/*
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 3844,3849 ****
|
|
Karsten Hopp |
964446 |
--- 3885,3891 ----
|
|
Karsten Hopp |
964446 |
settmode(TMODE_COOK); /* set to normal mode */
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
# if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
|
|
Karsten Hopp |
964446 |
+ save_clipboard();
|
|
Karsten Hopp |
964446 |
loose_clipboard();
|
|
Karsten Hopp |
964446 |
# endif
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 3917,3922 ****
|
|
Karsten Hopp |
964446 |
--- 3959,3967 ----
|
|
Karsten Hopp |
964446 |
# ifdef FEAT_TITLE
|
|
Karsten Hopp |
964446 |
resettitle();
|
|
Karsten Hopp |
964446 |
# endif
|
|
Karsten Hopp |
964446 |
+ # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
|
|
Karsten Hopp |
964446 |
+ restore_clipboard();
|
|
Karsten Hopp |
964446 |
+ # endif
|
|
Karsten Hopp |
964446 |
return x;
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
#else /* USE_SYSTEM */ /* don't use system(), use fork()/exec() */
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 3965,3970 ****
|
|
Karsten Hopp |
964446 |
--- 4010,4018 ----
|
|
Karsten Hopp |
964446 |
settmode(TMODE_COOK); /* set to normal mode */
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
# if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
|
|
Karsten Hopp |
964446 |
+ /* Disown the clipboard, because is the executed command tries to obtain a
|
|
Karsten Hopp |
964446 |
+ * selection and we own it we get a deadlock. */
|
|
Karsten Hopp |
964446 |
+ save_clipboard();
|
|
Karsten Hopp |
964446 |
loose_clipboard();
|
|
Karsten Hopp |
964446 |
# endif
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 4836,4841 ****
|
|
Karsten Hopp |
964446 |
--- 4884,4892 ----
|
|
Karsten Hopp |
964446 |
# ifdef FEAT_TITLE
|
|
Karsten Hopp |
964446 |
resettitle();
|
|
Karsten Hopp |
964446 |
# endif
|
|
Karsten Hopp |
964446 |
+ # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
|
|
Karsten Hopp |
964446 |
+ restore_clipboard();
|
|
Karsten Hopp |
964446 |
+ # endif
|
|
Karsten Hopp |
964446 |
vim_free(newcmd);
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
return retval;
|
|
Karsten Hopp |
964446 |
*** ../vim-7.3.855/src/proto/ui.pro 2012-07-10 16:49:08.000000000 +0200
|
|
Karsten Hopp |
964446 |
--- src/proto/ui.pro 2013-03-13 17:35:08.000000000 +0100
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 29,34 ****
|
|
Karsten Hopp |
964446 |
--- 29,35 ----
|
|
Karsten Hopp |
964446 |
void clip_gen_lose_selection __ARGS((VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
void clip_gen_set_selection __ARGS((VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
void clip_gen_request_selection __ARGS((VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
+ int clip_gen_owner_exists __ARGS((VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
int vim_is_input_buf_full __ARGS((void));
|
|
Karsten Hopp |
964446 |
int vim_is_input_buf_empty __ARGS((void));
|
|
Karsten Hopp |
964446 |
int vim_free_in_input_buf __ARGS((void));
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 52,57 ****
|
|
Karsten Hopp |
964446 |
--- 53,59 ----
|
|
Karsten Hopp |
964446 |
void clip_x11_lose_selection __ARGS((Widget myShell, VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
int clip_x11_own_selection __ARGS((Widget myShell, VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
void clip_x11_set_selection __ARGS((VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
+ int clip_x11_owner_exists __ARGS((VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
void yank_cut_buffer0 __ARGS((Display *dpy, VimClipboard *cbd));
|
|
Karsten Hopp |
964446 |
int jump_to_mouse __ARGS((int flags, int *inclusive, int which_button));
|
|
Karsten Hopp |
964446 |
int mouse_comp_pos __ARGS((win_T *win, int *rowp, int *colp, linenr_T *lnump));
|
|
Karsten Hopp |
964446 |
*** ../vim-7.3.855/src/ui.c 2013-03-07 18:02:27.000000000 +0100
|
|
Karsten Hopp |
964446 |
--- src/ui.c 2013-03-13 17:31:31.000000000 +0100
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 1456,1461 ****
|
|
Karsten Hopp |
964446 |
--- 1456,1476 ----
|
|
Karsten Hopp |
964446 |
#endif
|
|
Karsten Hopp |
964446 |
}
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
+ int
|
|
Karsten Hopp |
964446 |
+ clip_gen_owner_exists(cbd)
|
|
Karsten Hopp |
964446 |
+ VimClipboard *cbd;
|
|
Karsten Hopp |
964446 |
+ {
|
|
Karsten Hopp |
964446 |
+ #ifdef FEAT_XCLIPBOARD
|
|
Karsten Hopp |
964446 |
+ # ifdef FEAT_GUI_GTK
|
|
Karsten Hopp |
964446 |
+ if (gui.in_use)
|
|
Karsten Hopp |
964446 |
+ return clip_gtk_owner_exists(cbd);
|
|
Karsten Hopp |
964446 |
+ else
|
|
Karsten Hopp |
964446 |
+ # endif
|
|
Karsten Hopp |
964446 |
+ return clip_x11_owner_exists(cbd);
|
|
Karsten Hopp |
964446 |
+ #endif
|
|
Karsten Hopp |
964446 |
+ return TRUE;
|
|
Karsten Hopp |
964446 |
+ }
|
|
Karsten Hopp |
964446 |
+
|
|
Karsten Hopp |
964446 |
#endif /* FEAT_CLIPBOARD */
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
/*****************************************************************************
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 2398,2404 ****
|
|
Karsten Hopp |
964446 |
Widget myShell;
|
|
Karsten Hopp |
964446 |
VimClipboard *cbd;
|
|
Karsten Hopp |
964446 |
{
|
|
Karsten Hopp |
964446 |
! XtDisownSelection(myShell, cbd->sel_atom, CurrentTime);
|
|
Karsten Hopp |
964446 |
}
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
int
|
|
Karsten Hopp |
964446 |
--- 2413,2420 ----
|
|
Karsten Hopp |
964446 |
Widget myShell;
|
|
Karsten Hopp |
964446 |
VimClipboard *cbd;
|
|
Karsten Hopp |
964446 |
{
|
|
Karsten Hopp |
964446 |
! XtDisownSelection(myShell, cbd->sel_atom,
|
|
Karsten Hopp |
964446 |
! XtLastTimestampProcessed(XtDisplay(myShell)));
|
|
Karsten Hopp |
964446 |
}
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
int
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 2440,2445 ****
|
|
Karsten Hopp |
964446 |
--- 2456,2468 ----
|
|
Karsten Hopp |
964446 |
VimClipboard *cbd UNUSED;
|
|
Karsten Hopp |
964446 |
{
|
|
Karsten Hopp |
964446 |
}
|
|
Karsten Hopp |
964446 |
+
|
|
Karsten Hopp |
964446 |
+ int
|
|
Karsten Hopp |
964446 |
+ clip_x11_owner_exists(cbd)
|
|
Karsten Hopp |
964446 |
+ VimClipboard *cbd;
|
|
Karsten Hopp |
964446 |
+ {
|
|
Karsten Hopp |
964446 |
+ return XGetSelectionOwner(X_DISPLAY, cbd->sel_atom) != None;
|
|
Karsten Hopp |
964446 |
+ }
|
|
Karsten Hopp |
964446 |
#endif
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_GUI_X11) \
|
|
Karsten Hopp |
964446 |
*** ../vim-7.3.855/src/version.c 2013-03-13 17:01:47.000000000 +0100
|
|
Karsten Hopp |
964446 |
--- src/version.c 2013-03-13 17:45:25.000000000 +0100
|
|
Karsten Hopp |
964446 |
***************
|
|
Karsten Hopp |
964446 |
*** 730,731 ****
|
|
Karsten Hopp |
964446 |
--- 730,733 ----
|
|
Karsten Hopp |
964446 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
964446 |
+ /**/
|
|
Karsten Hopp |
964446 |
+ 856,
|
|
Karsten Hopp |
964446 |
/**/
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
--
|
|
Karsten Hopp |
964446 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
964446 |
39. You move into a new house and decide to Netscape before you landscape.
|
|
Karsten Hopp |
964446 |
|
|
Karsten Hopp |
964446 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
964446 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
964446 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
964446 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|