From 929ef9f5ec503a5ab2645ea45cfa7f2e4ef8b66a Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Fri, 20 Jul 2018 13:18:33 +0300 Subject: [PATCH] rc lint: Escape pipes in diagnostics --- rc/base/lint.kak | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rc/base/lint.kak b/rc/base/lint.kak index 0e51f46d..dfa35037 100644 --- a/rc/base/lint.kak +++ b/rc/base/lint.kak @@ -55,10 +55,12 @@ define-command lint -docstring 'Parse the current buffer with a linter' %{ /:[0-9]+:[0-9]+:/ { kind = substr($4, 2) error = $2 "." $3 "," $2 "." $3 "|" kind + msg = "" # fix case where $5 is not the last field because of extra colons in the message - for (i=5; i<=NF; i++) error = error "\\:" $i - error = error " (col " $3 ")" - gsub("'\''", "'"''"'", error) + for (i=5; i<=NF; i++) msg = msg ":" $i + gsub(/\|/, "\\|", msg) + gsub("'\''", "'"''"'", msg) + error = error msg " (col " $3 ")" errors = errors " '\''" error "'\''" } END {