To: [email protected]
Subject: Patch 6.1a.042
Fcc: outbox
From: Bram Moolenaar <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 6.1a.042
Problem:    When merging files, ":diffput" and ":diffget" are used a lot, but
           they require a lot of typing.
Solution:   Add "dp" for ":diffput" and "do" for ":diffget".
Files:      runtime/doc/diff.txt, src/diff.c, src/normal.c, src/proto/diff.pro


*** ../vim61a.041/runtime/doc/diff.txt  Sun Feb 24 17:14:24 2002
--- runtime/doc/diff.txt        Sat Mar  9 15:17:47 2002
***************
*** 1,4 ****
! *diff.txt*      For Vim version 6.1a.  Last change: 2001 Nov 06


                 VIM REFERENCE MANUAL    by Bram Moolenaar
--- 1,4 ----
! *diff.txt*      For Vim version 6.1a.  Last change: 2002 Mar 09


                 VIM REFERENCE MANUAL    by Bram Moolenaar
***************
*** 223,228 ****
--- 223,235 ----
               buffer.  Just like ":diffget" but the other buffer is modified
               instead of the current one.
               See below for [range].
+
+                                                       *do*
+ do            Same as ":diffget" without argument or range.  The "o" stands
+               for "obtain" ("dg" can't be used for this!).
+
+                                                       *dp*
+ dp            Same as ":diffput" without argument or range.

 When no [range] is given, the diff at the cursor position or just above it is
 affected.  When [range] is used, Vim tries to only put or get the specified
*** ../vim61a.041/src/diff.c    Thu Feb  7 22:14:11 2002
--- src/diff.c  Sat Mar  9 15:12:37 2002
***************
*** 1677,1682 ****
--- 1677,1702 ----
 #endif

 /*
+  * "dp" and "do" commands.
+  */
+     void
+ nv_diffgetput(put)
+     int               put;
+ {
+     exarg_T   ea;
+
+     ea.arg = "";
+     if (put)
+       ea.cmdidx = CMD_diffput;
+     else
+       ea.cmdidx = CMD_diffget;
+     ea.addr_count = 0;
+     ea.line1 = curwin->w_cursor.lnum;
+     ea.line2 = curwin->w_cursor.lnum;
+     ex_diffgetput(&ea);
+ }
+
+ /*
  * ":diffget"
  * ":diffput"
  */
*** ../vim61a.041/src/normal.c  Fri Feb 22 14:49:09 2002
--- src/normal.c        Sat Mar  9 15:12:43 2002
***************
*** 7854,7860 ****
--- 7854,7871 ----
     int               flags = 0;

     if (cap->oap->op_type != OP_NOP)
+     {
+ #ifdef FEAT_DIFF
+       /* "dp" is ":diffput" */
+       if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'p')
+       {
+           clearop(cap->oap);
+           nv_diffgetput(TRUE);
+       }
+       else
+ #endif
       clearopbeep(cap->oap);
+     }
     else
     {
       dir = (cap->cmdchar == 'P'
***************
*** 7917,7922 ****
--- 7928,7942 ----
 nv_open(cap)
     cmdarg_T  *cap;
 {
+ #ifdef FEAT_DIFF
+     /* "do" is ":diffget" */
+     if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'o')
+     {
+       clearop(cap->oap);
+       nv_diffgetput(FALSE);
+     }
+     else
+ #endif
 #ifdef FEAT_VISUAL
     if (VIsual_active)  /* switch start and end of visual */
       v_swap_corners(cap->cmdchar);
*** ../vim61a.041/src/proto/diff.pro    Sun Feb 24 17:26:59 2002
--- src/proto/diff.pro  Sat Mar  9 15:12:35 2002
***************
*** 15,20 ****
--- 15,21 ----
 int diffopt_changed __ARGS((void));
 int diff_find_change __ARGS((win_T *wp, linenr_T lnum, int *startp, int *endp));
 int diff_infold __ARGS((win_T *wp, linenr_T lnum));
+ void nv_diffgetput __ARGS((int put));
 void ex_diffgetput __ARGS((exarg_T *eap));
 int diff_mode_buf __ARGS((buf_T *buf));
 int diff_move_to __ARGS((int dir, long count));
*** ../vim61a.041/src/version.c Sat Mar  9 14:53:31 2002
--- src/version.c       Sat Mar  9 15:25:12 2002
***************
*** 608,609 ****
--- 608,611 ----
 {   /* Add new patch number below this line */
+ /**/
+     42,
 /**/

--
hundred-and-one symptoms of being an internet addict:
214. Your MCI "Circle of Friends" are all Hayes-compatible.

///  Bram Moolenaar -- [email protected] -- http://www.moolenaar.net  \\\
///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
\\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
\\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///