diff options
author | 2020-03-30 18:44:15 -0400 | |
---|---|---|
committer | 2020-03-30 18:44:15 -0400 | |
commit | c46527cc32aef6fd332ea5e45757c0858b1cbb5d (patch) | |
tree | 8ffd94daf08117a21469697c4cec2c14a5bfdeb3 /modules/lua/init.lua | |
parent | 4d88d116f8f8181186fd734841d5303269924c16 (diff) | |
download | textadept-c46527cc32aef6fd332ea5e45757c0858b1cbb5d.tar.gz textadept-c46527cc32aef6fd332ea5e45757c0858b1cbb5d.zip |
Fixed off-by-one issues with `buffer:get_cur_line()`.
Diffstat (limited to 'modules/lua/init.lua')
-rw-r--r-- | modules/lua/init.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/lua/init.lua b/modules/lua/init.lua index 7a06b302..056e230b 100644 --- a/modules/lua/init.lua +++ b/modules/lua/init.lua @@ -26,6 +26,7 @@ local function ta_api(filename) buffer == ui.command_entry or buffer._type then return filename end + ui.dialogs.msgbox{text=filename,informative_text=buffer.filename} end end @@ -61,7 +62,8 @@ textadept.editing.autocompleters.lua = function() local list = {} -- Retrieve the symbol behind the caret. local line, pos = buffer:get_cur_line() - local symbol, op, part = line:sub(1, pos):match('([%w_%.]-)([%.:]?)([%w_]*)$') + local symbol, op, part = line:sub(1, pos - 1):match( + '([%w_%.]-)([%.:]?)([%w_]*)$') if symbol == '' and part == '' then return nil end -- nothing to complete if symbol == '' and M.autocomplete_snippets then local _, snippets = textadept.editing.autocompleters.snippet() |