From c46527cc32aef6fd332ea5e45757c0858b1cbb5d Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 30 Mar 2020 18:44:15 -0400 Subject: Fixed off-by-one issues with `buffer:get_cur_line()`. --- modules/textadept/command_entry.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/textadept/command_entry.lua') diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua index 7929a6b8..8310a8b8 100644 --- a/modules/textadept/command_entry.lua +++ b/modules/textadept/command_entry.lua @@ -121,7 +121,8 @@ args.register('-e', '--execute', 1, run_lua, 'Execute Lua code') -- `ui` tables are also considered as globals. local function complete_lua() local line, pos = M: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_]*)$') local ok, result = pcall( (load(string.format('return (%s)', symbol), nil, 't', env))) if (not ok or type(result) ~= 'table') and symbol ~= '' then return end -- cgit v1.2.3