From 10ac883b60dc86dd3531d9aaf15d43f2b6a64338 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 15 Jan 2017 11:22:47 +0000 Subject: [PATCH] Use byte offsets in spell Fixes #1126 --- rc/base/spell.kak | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rc/base/spell.kak b/rc/base/spell.kak index bf4dfbf3..ab81f67b 100644 --- a/rc/base/spell.kak +++ b/rc/base/spell.kak @@ -26,7 +26,7 @@ Formats of language supported: fi { - sed 's/^/^/' "$kak_opt_spell_tmp_file" | eval "aspell -a $options" 2>&1 | { + sed 's/^/^/' "$kak_opt_spell_tmp_file" | eval "aspell --byte-offsets -a $options" 2>&1 | { line_num=1 regions=$kak_timestamp read line # drop the identification message @@ -39,7 +39,8 @@ Formats of language supported: pos=$(printf %s\\n "$line" | cut -d ' ' -f 3) fi word=$(printf %s\\n "$line" | cut -d ' ' -f 2) - regions="$regions:$line_num.$pos+${#word}|Error" + len=$(printf %s "$word" | wc -c) + regions="$regions:$line_num.$pos+${len}|Error" ;; '') line_num=$((line_num + 1));; \*) ;;