aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/command_entry.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2020-03-30 18:44:15 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2020-03-30 18:44:15 -0400
commitc46527cc32aef6fd332ea5e45757c0858b1cbb5d (patch)
tree8ffd94daf08117a21469697c4cec2c14a5bfdeb3 /modules/textadept/command_entry.lua
parent4d88d116f8f8181186fd734841d5303269924c16 (diff)
downloadtextadept-c46527cc32aef6fd332ea5e45757c0858b1cbb5d.tar.gz
textadept-c46527cc32aef6fd332ea5e45757c0858b1cbb5d.zip
Fixed off-by-one issues with `buffer:get_cur_line()`.
Diffstat (limited to 'modules/textadept/command_entry.lua')
-rw-r--r--modules/textadept/command_entry.lua3
1 files changed, 2 insertions, 1 deletions
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