Karsten Hopp 493006
To: vim-dev@vim.org
Karsten Hopp 493006
Subject: Patch 7.2.086
Karsten Hopp 493006
Fcc: outbox
Karsten Hopp 493006
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 493006
Mime-Version: 1.0
Karsten Hopp 493006
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 493006
Content-Transfer-Encoding: 8bit
Karsten Hopp 493006
------------
Karsten Hopp 493006
Karsten Hopp 493006
Patch 7.2.086
Karsten Hopp 493006
Problem:    Using ":diffget 1" in buffer 1 corrupts the text.
Karsten Hopp 493006
Solution:   Don't do anything when source and destination of ":diffget" or
Karsten Hopp 493006
	    ":diffput" is the same buffer. (Dominique Pelle)
Karsten Hopp 493006
Files:	    src/diff.c
Karsten Hopp 493006
Karsten Hopp 493006
Karsten Hopp 493006
*** ../vim-7.2.085/src/diff.c	Sun Nov 30 15:15:56 2008
Karsten Hopp 493006
--- src/diff.c	Wed Jan 14 20:40:25 2009
Karsten Hopp 493006
***************
Karsten Hopp 493006
*** 8,14 ****
Karsten Hopp 493006
   */
Karsten Hopp 493006
  
Karsten Hopp 493006
  /*
Karsten Hopp 493006
!  * diff.c: code for diff'ing two or three buffers.
Karsten Hopp 493006
   */
Karsten Hopp 493006
  
Karsten Hopp 493006
  #include "vim.h"
Karsten Hopp 493006
--- 8,14 ----
Karsten Hopp 493006
   */
Karsten Hopp 493006
  
Karsten Hopp 493006
  /*
Karsten Hopp 493006
!  * diff.c: code for diff'ing two, three or four buffers.
Karsten Hopp 493006
   */
Karsten Hopp 493006
  
Karsten Hopp 493006
  #include "vim.h"
Karsten Hopp 493006
***************
Karsten Hopp 493006
*** 116,122 ****
Karsten Hopp 493006
   * Add a buffer to make diffs for.
Karsten Hopp 493006
   * Call this when a new buffer is being edited in the current window where
Karsten Hopp 493006
   * 'diff' is set.
Karsten Hopp 493006
!  * Marks the current buffer as being part of the diff and requireing updating.
Karsten Hopp 493006
   * This must be done before any autocmd, because a command may use info
Karsten Hopp 493006
   * about the screen contents.
Karsten Hopp 493006
   */
Karsten Hopp 493006
--- 116,122 ----
Karsten Hopp 493006
   * Add a buffer to make diffs for.
Karsten Hopp 493006
   * Call this when a new buffer is being edited in the current window where
Karsten Hopp 493006
   * 'diff' is set.
Karsten Hopp 493006
!  * Marks the current buffer as being part of the diff and requiring updating.
Karsten Hopp 493006
   * This must be done before any autocmd, because a command may use info
Karsten Hopp 493006
   * about the screen contents.
Karsten Hopp 493006
   */
Karsten Hopp 493006
***************
Karsten Hopp 493006
*** 929,935 ****
Karsten Hopp 493006
  	goto theend;
Karsten Hopp 493006
  
Karsten Hopp 493006
  #ifdef UNIX
Karsten Hopp 493006
!     /* Temporaraly chdir to /tmp, to avoid patching files in the current
Karsten Hopp 493006
       * directory when the patch file contains more than one patch.  When we
Karsten Hopp 493006
       * have our own temp dir use that instead, it will be cleaned up when we
Karsten Hopp 493006
       * exit (any .rej files created).  Don't change directory if we can't
Karsten Hopp 493006
--- 929,935 ----
Karsten Hopp 493006
  	goto theend;
Karsten Hopp 493006
  
Karsten Hopp 493006
  #ifdef UNIX
Karsten Hopp 493006
!     /* Temporarily chdir to /tmp, to avoid patching files in the current
Karsten Hopp 493006
       * directory when the patch file contains more than one patch.  When we
Karsten Hopp 493006
       * have our own temp dir use that instead, it will be cleaned up when we
Karsten Hopp 493006
       * exit (any .rej files created).  Don't change directory if we can't
Karsten Hopp 493006
***************
Karsten Hopp 493006
*** 2129,2134 ****
Karsten Hopp 493006
--- 2129,2136 ----
Karsten Hopp 493006
  	    EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg);
Karsten Hopp 493006
  	    return;
Karsten Hopp 493006
  	}
Karsten Hopp 493006
+ 	if (buf == curbuf)
Karsten Hopp 493006
+ 	    return;		/* nothing to do */
Karsten Hopp 493006
  	idx_other = diff_buf_idx(buf);
Karsten Hopp 493006
  	if (idx_other == DB_COUNT)
Karsten Hopp 493006
  	{
Karsten Hopp 493006
*** ../vim-7.2.085/src/version.c	Thu Jan 22 18:32:55 2009
Karsten Hopp 493006
--- src/version.c	Thu Jan 22 20:46:54 2009
Karsten Hopp 493006
***************
Karsten Hopp 493006
*** 678,679 ****
Karsten Hopp 493006
--- 678,681 ----
Karsten Hopp 493006
  {   /* Add new patch number below this line */
Karsten Hopp 493006
+ /**/
Karsten Hopp 493006
+     86,
Karsten Hopp 493006
  /**/
Karsten Hopp 493006
Karsten Hopp 493006
-- 
Karsten Hopp 493006
Shift happens.
Karsten Hopp 493006
                -- Doppler
Karsten Hopp 493006
Karsten Hopp 493006
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 493006
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 493006
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 493006
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///