summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-11-19 18:48:46 +0100
committerBram Moolenaar <Bram@vim.org>2014-11-19 18:48:46 +0100
commitb1e265045cc872f2e1cf43e6a98bc3e3770a289d (patch)
tree4b8418e08f01728d7214226e096f34b06bf6a154
parent4c7b2f50fd6590c9b98d896978515edf0bf142bb (diff)
downloadvim-git-b1e265045cc872f2e1cf43e6a98bc3e3770a289d.tar.gz
updated for version 7.4.523v7.4.523
Problem: When the X11 server is stopped and restarted, while Vim is kept in the background, copy/paste no longer works. (Issue 203) Solution: Setup the clipboard again. (Christian Brabandt)
-rw-r--r--src/os_unix.c21
-rw-r--r--src/version.c2
2 files changed, 23 insertions, 0 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 8cd6b14eb..0813cae73 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1586,12 +1586,15 @@ x_IOerror_check(dpy)
* An X IO Error handler, used to catch terminal errors.
*/
static int x_IOerror_handler __ARGS((Display *dpy));
+static void may_restore_clipboard __ARGS((void));
+static int xterm_dpy_was_reset = FALSE;
static int
x_IOerror_handler(dpy)
Display *dpy UNUSED;
{
xterm_dpy = NULL;
+ xterm_dpy_was_reset = TRUE;
x11_window = 0;
x11_display = NULL;
xterm_Shell = (Widget)0;
@@ -1602,6 +1605,22 @@ x_IOerror_handler(dpy)
return 0; /* avoid the compiler complains about missing return value */
# endif
}
+
+/*
+ * If the X11 connection was lost try to restore it.
+ * Helps when the X11 server was stopped and restarted while Vim was inactive
+ * (e.g. though tmux).
+ */
+ static void
+may_restore_clipboard()
+{
+ if (xterm_dpy_was_reset)
+ {
+ xterm_dpy_was_reset = FALSE;
+ setup_term_clip();
+ get_x11_title(FALSE);
+ }
+}
#endif
/*
@@ -5274,6 +5293,7 @@ RealWaitForChar(fd, msec, check_for_gpm)
}
# endif
# ifdef FEAT_XCLIPBOARD
+ may_restore_clipboard();
if (xterm_Shell != (Widget)0)
{
xterm_idx = nfd;
@@ -5426,6 +5446,7 @@ select_eintr:
}
# endif
# ifdef FEAT_XCLIPBOARD
+ may_restore_clipboard();
if (xterm_Shell != (Widget)0)
{
FD_SET(ConnectionNumber(xterm_dpy), &rfds);
diff --git a/src/version.c b/src/version.c
index 7a86692d7..cc3bb2435 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 523,
+/**/
522,
/**/
521,