1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-22 02:20:05 +03:00

clang.kak: Use two sed processes instead of one to avoid extra long pattern space

The previous version was ending up with all the completion candidates
in a single, multiline pattern space, regex substitution on it was
extremely slow compared to the two process version where substitution
is always running on a single candidate.
This commit is contained in:
Maxime Coste 2016-08-30 23:23:33 +01:00
parent 3831117bc7
commit 80298a95a0

View File

@ -63,8 +63,7 @@ def clang-parse -params 0..1 -docstring "Parse the contents of the current buffe
docstrings[id]=desc
}
END {
for (id in docstrings)
{
for (id in docstrings) {
menu=id
gsub(/(^|[^[:alnum:]_])(operator|new|delete)($|[^[:alnum:]_])/, "{keyword}&{}", menu)
gsub(/(^|[[:space:]])(int|size_t|bool|char|unsigned|signed|long)($|[[:space:]])/, "{type}&{}", menu)
@ -102,7 +101,7 @@ def -hidden clang-show-completion-info %[ try %[
eval -draft %[
exec <space>{( <a-k> ^\( <ret> b <a-k> \`\w+\' <ret>
%sh[
desc=$(printf %s\\n "${kak_opt_clang_completions}" | sed -ne "{ s/\([^\\]\):/\1\n/g }; /^${kak_selection}|/ { s/^[^|]\+|//; s/|.*$//; s/\\\:/:/g; P }; D")
desc=$(printf %s\\n "${kak_opt_clang_completions}" | sed -e "{ s/\([^\\]\):/\1\n/g }" | sed -ne "/^${kak_selection}|/ { s/^[^|]\+|//; s/|.*$//; s/\\\:/:/g; p }")
if [ -n "$desc" ]; then
printf %s\\n "eval -client $kak_client %{info -anchor ${kak_cursor_line}.${kak_cursor_column} -placement above %{${desc}}}"
fi