Merge remote-tracking branch 'lenormf/fix-spell'
This commit is contained in:
commit
dcebdd54f3
|
@ -18,35 +18,39 @@ Formats of language supported:
|
||||||
if [ $# -ge 1 ]; then
|
if [ $# -ge 1 ]; then
|
||||||
if [ ${#1} -ne 2 -a ${#1} -ne 5 ]; then
|
if [ ${#1} -ne 2 -a ${#1} -ne 5 ]; then
|
||||||
echo 'echo -color Error Invalid language code (examples of expected format: en, en_US, en-US)'
|
echo 'echo -color Error Invalid language code (examples of expected format: en, en_US, en-US)'
|
||||||
rm -r $(dirname $kak_opt_spell_tmp_file)
|
rm -r "$(dirname "$kak_opt_spell_tmp_file")"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
options="-l $1"
|
options="-l '$1'"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
sed 's/^/^/' < $kak_opt_spell_tmp_file | aspell -a $options 2>&1 | tee /tmp/spell-out | {
|
|
||||||
line_num=1
|
{
|
||||||
regions=$kak_timestamp
|
sed 's/^/^/' "$kak_opt_spell_tmp_file" | eval "aspell -a $options" 2>&1 | {
|
||||||
read line # drop the identification message
|
line_num=1
|
||||||
while read line; do
|
regions=$kak_timestamp
|
||||||
case "$line" in
|
read line # drop the identification message
|
||||||
[\#\&]*)
|
while read -r line; do
|
||||||
if expr "$line" : '^&' >/dev/null; then
|
case "$line" in
|
||||||
begin=$(printf %s\\n "$line" | cut -d ' ' -f 4 | sed 's/:$//')
|
[\#\&]*)
|
||||||
else
|
if expr "$line" : '^&' >/dev/null; then
|
||||||
begin=$(printf %s\\n "$line" | cut -d ' ' -f 3)
|
begin=$(printf %s\\n "$line" | cut -d ' ' -f 4 | sed 's/:$//')
|
||||||
fi
|
else
|
||||||
word=$(printf %s\\n "$line" | cut -d ' ' -f 2)
|
begin=$(printf %s\\n "$line" | cut -d ' ' -f 3)
|
||||||
end=$((begin + ${#word}))
|
fi
|
||||||
regions="$regions:$line_num.$begin,$line_num.$end|Error"
|
word=$(printf %s\\n "$line" | cut -d ' ' -f 2)
|
||||||
;;
|
end=$((begin + ${#word}))
|
||||||
'') line_num=$((line_num + 1));;
|
regions="$regions:$line_num.$begin,$line_num.$end|Error"
|
||||||
\*) ;;
|
;;
|
||||||
*) printf 'echo -color Error %%{%s}\n' "${line}";;
|
'') line_num=$((line_num + 1));;
|
||||||
esac
|
\*) ;;
|
||||||
done
|
*) printf 'echo -color Error %%{%s}\n' "${line}" | kak -p "${kak_session}";;
|
||||||
printf 'set buffer spell_regions %%{%s}' "${regions}"
|
esac
|
||||||
}
|
done
|
||||||
rm -r $(dirname $kak_opt_spell_tmp_file)
|
printf 'set "buffer=%s" spell_regions %%{%s}' "${kak_bufname}" "${regions}" \
|
||||||
|
| kak -p "${kak_session}"
|
||||||
|
}
|
||||||
|
rm -r $(dirname "$kak_opt_spell_tmp_file")
|
||||||
|
} </dev/null >/dev/null 2>&1 &
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user