Loading ...
Sorry, an error occurred while loading the content.

53689[PATCH] support for the bang in :diffthis (was Re: [PATCH] :diffoff should not change settings for non-diff windows)

Expand Messages
  • Markus Heidelberg
    Mar 5, 2009
      Lech Lorens, 05.03.2009:
      > Perfectly fine with me - I hardly ever use :diffoff without !, anyway.

      Is there a reason to not support the corresponding :diffthis! command?
      For consistency it seems like a good idea, instead of using two
      different ways ":windo diffthis" and ":diffoff!". Furthermore :windo can
      move the cursor into another window, which is normally not desired.

      --- >8 ---

      Add support for :diffthis! for setting the diffmode in all windows in
      the current tab page.

      ---
      runtime/doc/diff.txt | 4 +++-
      src/diff.c | 12 +++++++++---
      src/ex_cmds.h | 2 +-
      3 files changed, 13 insertions(+), 5 deletions(-)

      diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt
      index 3f55c30..270a1bd 100644
      --- a/runtime/doc/diff.txt
      +++ b/runtime/doc/diff.txt
      @@ -88,8 +88,10 @@ While already in Vim you can start diff mode in three ways.
      Also see 'diffexpr'.

      *:difft* *:diffthis*
      -:diffthis Make the current window part of the diff windows. This sets
      +:diffthis[!] Make the current window part of the diff windows. This sets
      the options like for "vimdiff".
      + When the [!] is included set the diff mode for all windows in
      + the current tab page.

      :diffpatch {patchfile} *:diffp* *:diffpatch*
      Use the current buffer, patch it with the diff found in
      diff --git a/src/diff.c b/src/diff.c
      index c20d095..04aee4b 100644
      --- a/src/diff.c
      +++ b/src/diff.c
      @@ -1087,15 +1087,21 @@ ex_diffsplit(eap)
      }

      /*
      - * Set options to show difs for the current window.
      + * Set options to show diffs for the current window.
      */
      /*ARGSUSED*/
      void
      ex_diffthis(eap)
      exarg_T *eap;
      {
      - /* Set 'diff', 'scrollbind' on and 'wrap' off. */
      - diff_win_options(curwin, TRUE);
      + win_T *wp;
      +
      + for (wp = firstwin; wp != NULL; wp = wp->w_next)
      + {
      + if (wp == curwin || eap->forceit)
      + /* Set 'diff', 'scrollbind' on and 'wrap' off. */
      + diff_win_options(wp, TRUE);
      + }
      }

      /*
      diff --git a/src/ex_cmds.h b/src/ex_cmds.h
      index 4916750..08aa0d1 100644
      --- a/src/ex_cmds.h
      +++ b/src/ex_cmds.h
      @@ -316,7 +316,7 @@ EX(CMD_diffput, "diffput", ex_diffgetput,
      EX(CMD_diffsplit, "diffsplit", ex_diffsplit,
      EXTRA|FILE1|TRLBAR),
      EX(CMD_diffthis, "diffthis", ex_diffthis,
      - TRLBAR),
      + BANG|TRLBAR),
      EX(CMD_digraphs, "digraphs", ex_digraphs,
      EXTRA|TRLBAR|CMDWIN),
      EX(CMD_djump, "djump", ex_findpat,
      --
      1.6.2.15.g9514d




      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 13 messages in this topic