`repl` and `hilite` hang if empty string is passed
Closed this issue · 3 comments
Deleted user commented
ver | repl "" ""
hangs
ver | hilite -c "" green
does not hang and colors the entire output with specified color
ver | hilite -c "" green -m
hangs
malxau commented
Thanks for letting me know. As you've probably surmised, this happens because searching for an empty string matches at the beginning of the string, and continues matching the same offset without making progress.
I think the best fix for the two tools is a bit different though:
- For
repl
, it doesn't make much sense to replace an empty string with something, so this command should fail. - For
hilite
, it does make some sense to highlight the entire line with an empty string, which would match all lines allowing them to be displayed in color. However, highlighting a specific term that is empty makes no sense. Rather than fail completely, I think this should just not match and continue executing.
I'll push some changes for these over the next couple days.
malxau commented
malxau commented
1.60 is in stable now. Please reopen or file another issue if there's still something broken or missing here.