diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2020-03-26 17:37:08 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2020-03-26 17:37:08 -0400 |
commit | 940732342827ebe0d3bb98740419f621f9c77391 (patch) | |
tree | 32a3a6ac703429ca036e73c5215bac4f87b0818f /core/init.lua | |
parent | 52b0ec63792b3023b4ab42e42d2ce1e1fcb813bc (diff) |
Switched to 1-based indices for buffer positions, lines, and countable entities.
Diffstat (limited to 'core/init.lua')
-rw-r--r-- | core/init.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/init.lua b/core/init.lua index 8b4f3d48..ffa7bbe3 100644 --- a/core/init.lua +++ b/core/init.lua @@ -47,8 +47,8 @@ local function text_range(buffer, start_pos, end_pos) assert_type(start_pos, 'number', 2) assert_type(end_pos, 'number', 3) local target_start, target_end = buffer.target_start, buffer.target_end - if start_pos < 0 then start_pos = 0 end - if end_pos > buffer.length then end_pos = buffer.length end + if start_pos < 1 then start_pos = 1 end + if end_pos > buffer.length + 1 then end_pos = buffer.length + 1 end buffer:set_target_range(start_pos, end_pos) local text = buffer.target_text buffer:set_target_range(target_start, target_end) -- restore |