diff --git a/rc/tools/spell.kak b/rc/tools/spell.kak index 07318250..d062f3e4 100644 --- a/rc/tools/spell.kak +++ b/rc/tools/spell.kak @@ -58,7 +58,7 @@ define-command -params ..1 -docstring %{ } else if (/^[#&]/) { - word_len = length($2) - 1 + 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" } diff --git a/src/highlighters.cc b/src/highlighters.cc index ac33cf4f..45d34052 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -1481,7 +1481,7 @@ InclusiveBufferRange option_from_string(Meta::Type, String if (*sep == '+') { auto len = str_to_int({sep+1, str.end()}); - return {first, len == 0 ? BufferCoord{-1,-1} : BufferCoord{first.line, first.column + len}}; + return {first, len == 0 ? BufferCoord{-1,-1} : BufferCoord{first.line, first.column + len - 1}}; } const BufferCoord last{str_to_int({sep+1, dot_end}) - 1, str_to_int({dot_end+1, str.end()}) - 1}; diff --git a/test/highlight/ranges/cmd b/test/highlight/ranges/cmd new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/highlight/ranges/cmd @@ -0,0 +1 @@ + diff --git a/test/highlight/ranges/in b/test/highlight/ranges/in new file mode 100644 index 00000000..2b6167c4 --- /dev/null +++ b/test/highlight/ranges/in @@ -0,0 +1,4 @@ +foo +bar +baz +%( ) diff --git a/test/highlight/ranges/rc b/test/highlight/ranges/rc new file mode 100644 index 00000000..3f821a2f --- /dev/null +++ b/test/highlight/ranges/rc @@ -0,0 +1,3 @@ +declare-option range-specs r +add-highlighter window/ ranges r +set window r %val{timestamp} 1.1+0|default,red 2.1,2.1|default,red 3.1+2|default,red diff --git a/test/highlight/ranges/script b/test/highlight/ranges/script new file mode 100644 index 00000000..14c640d7 --- /dev/null +++ b/test/highlight/ranges/script @@ -0,0 +1,2 @@ +ui_out '{ "jsonrpc": "2.0", "method": "set_ui_options", "params": [{}] }' +ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "foo\u000a" }], [{ "face": { "fg": "default", "bg": "red", "attributes": [] }, "contents": "b" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "ar\u000a" }], [{ "face": { "fg": "default", "bg": "red", "attributes": [] }, "contents": "ba" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "z\u000a" }], [{ "face": { "fg": "black", "bg": "white", "attributes": [] }, "contents": " " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }'