Bat can highlight individual lines using the -H argument.
I have a use case for which I would like to highlight only a portion of a line, say from character 10 to 20. How should I do this? Is it a desirable feature? The command line option could be something like -H $LINE:10:20.
I don't think --highlight-line $LINE:$COL_START:$COL_END would be too great of an idea, to be honest. It's using a similar syntax to --line-range, but has a completely different meaning. Using a colon would probably be fine as long as it's clear that it's not a line range, but a character range (maybe 372.10:20?).
Other ideas:
10:20@$LINE10-20@$LINE10.20@$LINE$LINE/10.20$LINE/10-20$LINEc5:10 (e.g. 372c5:10)$LINE_5:10$LINE.5:10Note: We can't use commas because of the changes eventually being introduced with #654.
I was thinking about opening a PR for highlighting ranges as well, so I'd agree with you @eth-p on not using : as a separator. (My personnal favourite would be $LINE.10:20)
Range highlighting would be -H 1 -H 3:7, which could already be done in a less elegant fashion: -H 1 -H 3 -H 4 -H 5 -H 6 -H 7.
I made a table with possible scenarios with the corresponding syntax
(lines are uppercase starting with L, characters are lowercase starting with c, F/f stands for "from", T/t stands for "to")
Range|One line|Line range|Character range|Multiline character range
:-:|:-:|:-:|:-:|:-:
Start|-|LF:|L.cf:|LF.cf:
End|-|:LT|L.:.ct|:LT.ct
Both|L|LF:LT|L.cf:.ct|LF.cf:LT.ct
: means "range" - it separates start from end. means "char" - it separates line number from character numberIs that good or it needs changes?
Edited it a bit, now column numbers must be preceded with .
Most helpful comment
I made a table with possible scenarios with the corresponding syntax
(lines are uppercase starting with
L, characters are lowercase starting withc,F/fstands for "from",T/tstands for "to")Range|One line|Line range|Character range|Multiline character range
:-:|:-:|:-:|:-:|:-:
Start|-|
LF:|L.cf:|LF.cf:End|-|
:LT|L.:.ct|:LT.ctBoth|
L|LF:LT|L.cf:.ct|LF.cf:LT.ct:means "range" - it separates start from end.means "char" - it separates line number from character numberIs that good or it needs changes?