-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 git grep
handler doesn't highlight matches that start in column 0
#1056
Comments
jdpopkin
added a commit
to jdpopkin/delta
that referenced
this issue
Apr 25, 2022
This commit fixes highlighting the part of the line of code that matches the git grep query in cases where the match starts at the beginning of the lines. Fixes dandavison#1056.
jdpopkin
added a commit
to jdpopkin/delta
that referenced
this issue
Apr 26, 2022
This commit fixes highlighting the part of the line of code that matches the git grep query in cases where the match starts at the beginning of the lines. Fixes dandavison#1056.
dandavison
pushed a commit
that referenced
this issue
Jul 16, 2022
* Fix git-grep match-highlighting at line-start This commit fixes highlighting the part of the line of code that matches the git grep query in cases where the match starts at the beginning of the lines. Fixes #1056. * Fix handling of non-match highlight In some cases, `git grep` will customize the foreground-color for more than just the subset of the line that matches the grep pattern. This breaks the current match-detection behavior, which considers any characters with a non-default "foreground color" within the "code" part of a git-grep-ouput-line to be part of the match. This commit makes match-detection check for boldness and a red foreground instead of just checking for a non-default foreground-color. git grep matches are bold and red by default. But git grep isn't the only reason input to delta may contain color codes; there may still be cases where the highlighting looks wrong here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! It looks like the
git grep
handler can't highlight the grep-match if the grep-match starts at the beginning of the line of code. I'm not sure if this is always the case or if it's specific to my type of terminal in some way (I'm using Terminal.app on macOS).To repro,
On my machine, that leaves us with one line where foo is highlighted (
working.md
) and another line where it is not (broken.md
):Not a big deal for a trivial case like this (where the entire line matches the query exactly), but with a more complicated regex it can be annoying.
I have a fix for this. It's a little bit weird, but I think it should be okay.
The problem is in handling of ANSI color codes, which I suspect cannot be pasted here? But here's a
cat -v
representation of whatGIT_PAGER=less git color.grep=always grep 'foo'
does here:(Pretty hard to visually parse this, but: it highlights "foo" correctly on both lines.)
Thanks for filing a Delta bug report!
The text was updated successfully, but these errors were encountered: