Merge remote-tracking branch 'lenormf/fix-3399'

This commit is contained in:
Maxime Coste 2020-03-13 08:05:04 +11:00
commit a53d501f7b
3 changed files with 44 additions and 28 deletions

View File

@ -37,33 +37,48 @@ define-command -params ..1 -docstring %{
fi fi
{ {
sed 's/^/^/' "$kak_opt_spell_tmp_file" | eval "aspell --byte-offsets -a $options" 2>&1 | { sed 's/^/^/' "$kak_opt_spell_tmp_file" | eval "aspell --byte-offsets -a $options" 2>&1 | awk '
line_num=1 BEGIN {
regions=$kak_timestamp line_num = 1
while read -r line; do regions = ENVIRON["kak_timestamp"]
case "$line" in server_command = sprintf("kak -p \"%s\"", ENVIRON["kak_session"])
@\(\#\)*) }
# drop the identification message
;; {
[\#\&]*) if (/^@\(#\)/) {
if expr "$line" : '^&' >/dev/null; then /* drop the identification message */
pos=$(printf %s\\n "$line" | cut -d ' ' -f 4 | sed 's/:$//') }
else
pos=$(printf %s\\n "$line" | cut -d ' ' -f 3) else if (/^\*/) {
fi /* nothing */
word=$(printf %s\\n "$line" | cut -d ' ' -f 2) }
# trim whitespace to make `wc` output consistent across implementations
len=$(($(printf %s "$word" | wc -c))) else if (/^$/) {
regions="$regions $line_num.$pos+${len}|Error" line_num++
;; }
'') line_num=$((line_num + 1));;
\*) ;; else if (/^[#&]/) {
*) printf 'fail %s\n' "${line}" | kak -p "${kak_session}";; word_len = length($2)
esac word_pos = substr($0, 1, 1) == "&" ? substr($4, 1, length($4) - 1) : $3;
done regions = regions " " line_num "." word_pos "+" word_len "|Error"
printf 'set-option "buffer=%s" spell_regions %s' "${kak_bufname}" "${regions}" \ }
| kak -p "${kak_session}"
} 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") rm -rf $(dirname "$kak_opt_spell_tmp_file")
} </dev/null >/dev/null 2>&1 & } </dev/null >/dev/null 2>&1 &
} }

View File

@ -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++) for (size_t i = 0; i < max_parsing_depth+1; i++)
{ {
big_nested_array[i] = '['; big_nested_array[i] = '[';

View File

@ -694,6 +694,7 @@ Optional<Key> NCursesUI::get_next_key()
case 'D': return masked_key(Key::Left); case 'D': return masked_key(Key::Left);
case 'F': return masked_key(Key::End); // PC/xterm style case 'F': return masked_key(Key::End); // PC/xterm style
case 'H': return masked_key(Key::Home); // 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 'Q': return masked_key(Key::F2);
case 'R': return masked_key(Key::F3); case 'R': return masked_key(Key::F3);
case 'S': return masked_key(Key::F4); case 'S': return masked_key(Key::F4);