Now that bat supports displaying a range of lines I would like to have bat be able to highlight one line.
My use case has to do with utilizing bat as a preview command in a fuzzy finder like fzf or skim.
Here is what we can do currently with bat: ![]()
(I'm just using a copy of preview.sh I've put up here)
So how can or should this be done? Invert the colors of the line? Does syntec api have something that makes this easy? Or should we just manipulate the grid portion of the display like the line number or insert an arrow in that gutter?
Again I'd be happy to work on it but would like some input before I do.
Sounds good!
So how can or should this be done? Invert the colors of the line?
I'd prefer using a background color, but this could be problematic when using different (dark or light) themes, I guess.
Does syntec api have something that makes this easy?
Not sure, but we translate syntect style => ANSI style ourselves, so it should be easy to modify the style in the highlighted lines.
Or should we just manipulate the grid portion of the display like the line number or insert an arrow in that gutter?
That would be problematic if no sidebar / no line-numbers are used.
The next syntect release will include the mentioned helper to modify line style.
Looks likes syntec has a new release! https://github.com/trishume/syntect/releases
I'll have to see if upgrading breaks anything.
Looks likes syntec has a new release! trishume/syntect/releases
I'll have to see if upgrading breaks anything.
See #345
Actually, I just realized that we might not need that helper function after all :smile:.
We never use background colors so far, so we can additional set them when we render to ANSI codes. I have implemented an initial prototype on the highlight-lines branch.
If someone wants to take this and turn it into a fully-working solution, that'd be greatly appreciated!
There are a few things to work out:
Released in v0.10.0.
Most helpful comment
See #345