From 3161a6255c2a24dd2629854040d53ac775e48e05 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Fri, 22 Nov 2019 09:30:30 +0100 Subject: [PATCH 1/2] rc clang: Handle nested tags in completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some completion candidates have e.g. `{#…#}` tags in their name/description. They can be nested, which the cleanup regex doesn't take into account. --- rc/tools/clang.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/tools/clang.kak b/rc/tools/clang.kak index f5622ddf..8a792173 100644 --- a/rc/tools/clang.kak +++ b/rc/tools/clang.kak @@ -55,7 +55,7 @@ The syntaxic errors detected during parsing are shown when auto-diagnostics are awk -F ': ' ' /^COMPLETION:/ && $2 !~ /[(,](Hidden|Inaccessible)[),]/ { candidate=$3 - gsub(/[[<{]#[^#]+#[]>}]/, "", candidate) + gsub(/[[<{]#.+?#[]>}]/, "", candidate) gsub(/~/, "~~", candidate) gsub(/\|/, "\\|", candidate) From 657eeb02d250d899cd12dcc0756b39afc6cffed1 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Fri, 22 Nov 2019 09:43:39 +0100 Subject: [PATCH 2/2] rc clang: Factorize multiple calls to `gsub` --- rc/tools/clang.kak | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rc/tools/clang.kak b/rc/tools/clang.kak index 8a792173..30a8f2a1 100644 --- a/rc/tools/clang.kak +++ b/rc/tools/clang.kak @@ -59,14 +59,12 @@ The syntaxic errors detected during parsing are shown when auto-diagnostics are gsub(/~/, "~~", candidate) gsub(/\|/, "\\|", candidate) - gsub(/[[{<]#|#[}>]/, "", $3) - gsub(/#]/, " ", $3) + gsub(/[[{<]#|#[]}>]/, "", $3) gsub(/:: /, "::", $3) gsub(/ +$/, "", $3) docstring=$4 ? $3 "\n" $4 : $3 - gsub(/~/, "~~", docstring) - gsub(/!/, "!!", docstring) + gsub(/~|!/, "&&", docstring) gsub(/\|/, "\\|", docstring) if (candidate in candidates) candidates[candidate]=candidates[candidate] "\n" docstring