Toggleable --full-diff option #69

Closed
tsibley opened this Issue Jul 20, 2012 · 7 comments

3 participants

@tsibley

I'd like to add a diff view toggle for the --full-diff option:

--full-diff
    Without this flag, "git log -p <path>..." shows commits that touch the specified paths, and
    diffs about the same specified paths. With this, the full diff is shown for commits that touch
    the specified paths; this means that "<path>..." limits only commits, and doesn’t limit diff
    for those commits.

    Note that this affects all diff-based output types, e.g. those produced by --stat etc.

Jonas (and others): are there thoughts on good keybindings for this? Would others like such an option as well? I find it very useful when performing pickaxe searches.

@jonas
Owner

I would prefer a future-proof solution, which can also be applied to possible new options. Something like the following perhaps:

bind generic 2 :set diff-options = "--full-diff"; :reload

Which would require

  • A new option called 'diff-options' similar to the existing 'blame-options'.
  • The possibility to bind 'tig scriptlets' to keybindings.
  • Improvements to the code reading and executing 'tig scripts'.
@vivien

I think adding user defined diff options may break some features in the diff view (e.g. --names-only or --color-words`). Am I mistaken?

@tsibley

It's certainly possible for arbitrary diff options to break tig's parsing of the git-diff output. The same is probably true, however, of the existing blame-options.

@tsibley

@jonas: Should diff-options replace the TIG_DIFF_OPTS environment variable, or coexist peacefully? I'd opt to replace the env var, but there may be particular value in the per-invocation uses of it.

@jonas
Owner

I don't see a reason to remove it, but we could start a deprecation process to avoid any surprises.

@tsibley

Nod. I already have code that coexists with TIG_DIFF_OPTS, so I'm fine leaving it for now. I'll document the precedence of each method.

@jonas
Owner
@jonas jonas added a commit that closed this issue Mar 14, 2014
@jonas prompt: introduce :toggle command
This moves most toggle actions to use :toggle <option-name>. This new
:toggle prompt command enables to manipulate all the current options
while avoiding having to create a separate toggle-* action for each
option.  To achieve this the :toggle command changes behavior based on
the type of the option that is toggled:

 - For bool and enum options it works the similar to how toggle-*
   actions works today.
 - For argument array options (e.g. diff-options), it permits to
   append/remove one or more arguments (similar to how
   toggle-ignore-space works).
 - For int and double options it allows to increment and decrement the
   value (e.g. author-width).

Bindings has been added to tigrc to stay backwards compatible.

Fixes #69
3418272
@jonas jonas closed this in 3418272 Mar 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment