Fixes#776
Previously, when a paired plus line had no edits, it received
plus-style. With this commit such a line receives
plus-non-emph-style.
There's no change to unpaired lines (still plus-style) and paired
lines with edits (still a mosaic of plus-non-emph-style and plus-emph-style).
(The above statements hold for minus lines also).
Since *-non-emph-style defaults to *-emph-style, this commit does not
result in any change in output for users using the defaults.
The diff in this commit contains sections with all of the following semantics:
minus-style (old line 1)
plus-style (new line 1)
zero-style (line 2)
minus-non-emph-style (old line 4, and unchanged sections of old line 3)
minus-emph-style (deleted word "chaffinch" in old line 3)
plus-non-emph-style (new line 3, and unchanged sections of new line 4)
plus-emph-style (added word "dodo" of new line 4)
* Allow navigate-regexp value to be overridden.
* Don't add an empty label to the navigate_regexp.
* Make --hunk-label=str not require --navigate.
* Change navigate regexp to navigate regex.
* Turn navigate-regex into an Option<String>.
Similar to 7a64fa5a26 which allowed
custom styles. Custom styles must end in -style, but colors can be
anything. It unfortunately seems not to be possible currently to store
a global reference to git config, hence the size of this
commit (passing the reference down the call stack).
- Handle standard filepath:code and filepath:line_number:code output
as produced by `git grep`, `rg -H`, `grep -H`, etc (with -n for line
numbers).
- Retain the match highlighting as produced by the grep tool, and
expose it in delta's color output styled with grep-match-style.
(Note that --color=always is needed to retain the color if piping
into delta, but not for `git grep` when delta is configured as git's
pager)
- Special handling of -p, and -W options of `git grep`: these display
the function context in which the matches occur.
- `navigate` keybindings jump between match function contexts under
`git grep -p` and between matching lines under `git grep -W`.
Thanks @zachriggle for the proposal.
Fixes#769