filters: fix colorize urls in signatures

When a signature contains a line that starts with an url, the url is not
highlighted properly:

  --
  Foobar
  [38;2;255;255;175mmhttps://foobar.org

The trailing m of the signature color start \x1b[38;2;175;135;255m is
considered as part of the URL scheme (i.e. mhttps:// instead of
https://). Colorize the URLs first before wrapping with the signature
color.

Fixes: df8c129235 ("filters: port colorize to awk")
Signed-off-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Robin Jarry 2022-02-23 22:34:41 +01:00
parent c77a1c5d9d
commit d2c239292e

View file

@ -77,8 +77,8 @@ function color_quote(line) {
$0 = diff_del $0 reset $0 = diff_del $0 reset
} }
} else if (in_signature) { } else if (in_signature) {
$0 = signature $0 reset
gsub(url_pattern, url "&" signature) gsub(url_pattern, url "&" signature)
$0 = signature $0 reset
} else if (in_headers) { } else if (in_headers) {
if ($0 ~ /^$/) { if ($0 ~ /^$/) {
in_signature = 0 in_signature = 0