jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.523

073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.523
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.523
073263
Problem:    When the X11 server is stopped and restarted, while Vim is kept in
073263
	    the background, copy/paste no longer works. (Issue 203)
073263
Solution:   Setup the clipboard again. (Christian Brabandt)
073263
Files:	    src/os_unix.c
073263
073263
073263
*** ../vim-7.4.522/src/os_unix.c	2014-11-19 16:38:01.520679869 +0100
073263
--- src/os_unix.c	2014-11-19 18:34:45.505245180 +0100
073263
***************
073263
*** 1586,1597 ****
073263
--- 1586,1600 ----
073263
   * An X IO Error handler, used to catch terminal errors.
073263
   */
073263
  static int x_IOerror_handler __ARGS((Display *dpy));
073263
+ static void may_restore_clipboard __ARGS((void));
073263
+ static int xterm_dpy_was_reset = FALSE;
073263
  
073263
      static int
073263
  x_IOerror_handler(dpy)
073263
      Display *dpy UNUSED;
073263
  {
073263
      xterm_dpy = NULL;
073263
+     xterm_dpy_was_reset = TRUE;
073263
      x11_window = 0;
073263
      x11_display = NULL;
073263
      xterm_Shell = (Widget)0;
073263
***************
073263
*** 1602,1607 ****
073263
--- 1605,1626 ----
073263
      return 0;  /* avoid the compiler complains about missing return value */
073263
  # endif
073263
  }
073263
+ 
073263
+ /*
073263
+  * If the X11 connection was lost try to restore it.
073263
+  * Helps when the X11 server was stopped and restarted while Vim was inactive
073263
+  * (e.g. though tmux).
073263
+  */
073263
+     static void
073263
+ may_restore_clipboard()
073263
+ {
073263
+     if (xterm_dpy_was_reset)
073263
+     {
073263
+ 	xterm_dpy_was_reset = FALSE;
073263
+ 	setup_term_clip();
073263
+ 	get_x11_title(FALSE);
073263
+     }
073263
+ }
073263
  #endif
073263
  
073263
  /*
073263
***************
073263
*** 5274,5279 ****
073263
--- 5293,5299 ----
073263
  	}
073263
  # endif
073263
  # ifdef FEAT_XCLIPBOARD
073263
+ 	may_restore_clipboard();
073263
  	if (xterm_Shell != (Widget)0)
073263
  	{
073263
  	    xterm_idx = nfd;
073263
***************
073263
*** 5426,5431 ****
073263
--- 5446,5452 ----
073263
  	}
073263
  # endif
073263
  # ifdef FEAT_XCLIPBOARD
073263
+ 	may_restore_clipboard();
073263
  	if (xterm_Shell != (Widget)0)
073263
  	{
073263
  	    FD_SET(ConnectionNumber(xterm_dpy), &rfds);
073263
*** ../vim-7.4.522/src/version.c	2014-11-19 18:03:24.202559721 +0100
073263
--- src/version.c	2014-11-19 18:48:06.140215792 +0100
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     523,
073263
  /**/
073263
073263
-- 
073263
There is no right or wrong, there is only your personal opinion.
073263
                 (Bram Moolenaar)
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///