From 610be9ac20dad2e0a5f76b027ab58b8bdf2a031c Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 4 Mar 2020 12:07:58 +1100 Subject: [PATCH 1/3] Fix invalid memory access in unit-tests --- src/json.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/json.cc b/src/json.cc index 82db4576..e50d3e61 100644 --- a/src/json.cc +++ b/src/json.cc @@ -178,7 +178,7 @@ UnitTest test_json_parser{[]() } { - String big_nested_array = {"", max_parsing_depth*2+2}; + String big_nested_array{' ', CharCount{max_parsing_depth*2+2}}; for (size_t i = 0; i < max_parsing_depth+1; i++) { big_nested_array[i] = '['; From 3881dc1e7aa79b00406a1b33c8587f06e3e297c6 Mon Sep 17 00:00:00 2001 From: Joachim Henke <37883863+jo-he@users.noreply.github.com> Date: Wed, 4 Mar 2020 09:06:46 +0100 Subject: [PATCH 2/3] restore F1 key handling --- src/ncurses_ui.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 1f9e1f81..55bdfda2 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -694,6 +694,7 @@ Optional NCursesUI::get_next_key() case 'D': return masked_key(Key::Left); case 'F': return masked_key(Key::End); // PC/xterm style case 'H': return masked_key(Key::Home); // PC/xterm style + case 'P': return masked_key(Key::F1); case 'Q': return masked_key(Key::F2); case 'R': return masked_key(Key::F3); case 'S': return masked_key(Key::F4); From e83ad2a2a4c78e6c1b753664942f2ddf744a85f3 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Mon, 9 Mar 2020 14:22:34 +0300 Subject: [PATCH 3/3] rc spell: Re-implement message processing in Awk Plain shell takes too long on large files. Fixes #3399 --- rc/tools/spell.kak | 69 ++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/rc/tools/spell.kak b/rc/tools/spell.kak index 0eeaceb5..a39c2204 100644 --- a/rc/tools/spell.kak +++ b/rc/tools/spell.kak @@ -37,33 +37,48 @@ define-command -params ..1 -docstring %{ fi { - sed 's/^/^/' "$kak_opt_spell_tmp_file" | eval "aspell --byte-offsets -a $options" 2>&1 | { - line_num=1 - regions=$kak_timestamp - while read -r line; do - case "$line" in - @\(\#\)*) - # drop the identification message - ;; - [\#\&]*) - if expr "$line" : '^&' >/dev/null; then - pos=$(printf %s\\n "$line" | cut -d ' ' -f 4 | sed 's/:$//') - else - pos=$(printf %s\\n "$line" | cut -d ' ' -f 3) - fi - word=$(printf %s\\n "$line" | cut -d ' ' -f 2) - # trim whitespace to make `wc` output consistent across implementations - len=$(($(printf %s "$word" | wc -c))) - regions="$regions $line_num.$pos+${len}|Error" - ;; - '') line_num=$((line_num + 1));; - \*) ;; - *) printf 'fail %s\n' "${line}" | kak -p "${kak_session}";; - esac - done - printf 'set-option "buffer=%s" spell_regions %s' "${kak_bufname}" "${regions}" \ - | kak -p "${kak_session}" - } + sed 's/^/^/' "$kak_opt_spell_tmp_file" | eval "aspell --byte-offsets -a $options" 2>&1 | awk ' + BEGIN { + line_num = 1 + regions = ENVIRON["kak_timestamp"] + server_command = sprintf("kak -p \"%s\"", ENVIRON["kak_session"]) + } + + { + if (/^@\(#\)/) { + /* drop the identification message */ + } + + else if (/^\*/) { + /* nothing */ + } + + else if (/^$/) { + line_num++ + } + + else if (/^[#&]/) { + word_len = length($2) + word_pos = substr($0, 1, 1) == "&" ? substr($4, 1, length($4) - 1) : $3; + regions = regions " " line_num "." word_pos "+" word_len "|Error" + } + + else { + line = $0 + gsub(/"/, "&&", line) + command = "fail \"" line "\"" + exit + } + } + + END { + if (!length(command)) + command = "set-option \"buffer=" ENVIRON["kak_bufname"] "\" spell_regions " regions + + print command | server_command + close(server_command) + } + ' rm -rf $(dirname "$kak_opt_spell_tmp_file") } /dev/null 2>&1 & }