aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2014-10-06 14:00:39 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2014-10-06 14:00:39 -0400
commit504de7dd0f22ea5e471e82bb85b9dcffd5367ada (patch)
tree22a363aa3bcd74cdfa663cb61354377f3b627751 /modules/textadept
parent5d12b299cd329f6a103c577040bb51a03a0f81ef (diff)
downloadtextadept-504de7dd0f22ea5e471e82bb85b9dcffd5367ada.tar.gz
textadept-504de7dd0f22ea5e471e82bb85b9dcffd5367ada.zip
Fixed autocomplete bug in curses; modules/textadept/command_entry.lua
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/command_entry.lua13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index f6549a71..46c1e842 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -66,6 +66,7 @@ M.editing_keys = {__index = {
-- @see _G.keys.MODE
-- @name enter_mode
function M.enter_mode(mode)
+ if M:auto_c_active() then M:auto_c_cancel() end -- may happen in curses
keys.MODE = mode
if mode and not keys[mode]['esc'] then keys[mode]['esc'] = M.enter_mode end
M:select_all()
@@ -122,13 +123,11 @@ local function execute_lua(code)
end
args.register('-e', '--execute', 1, execute_lua, 'Execute Lua code')
--- Shows a set of Lua code completions for string *code* or the entry's text.
--- Completions are subject to an "abbreviated" environment where the `buffer`,
--- `view`, and `ui` tables are also considered as globals.
--- @param code The Lua code to complete. The default value is the entry's text.
-local function complete_lua(code)
- if not code then code = M:get_text() end
- local symbol, op, part = code:match('([%w_.]-)([%.:]?)([%w_]*)$')
+-- Shows a set of Lua code completions for the entry's text, subject to an
+-- "abbreviated" environment where the `buffer`, `view`, and `ui` tables are
+-- also considered as globals.
+local function complete_lua()
+ local symbol, op, part = M:get_text():match('([%w_.]-)([%.:]?)([%w_]*)$')
local ok, result = pcall((load('return ('..symbol..')', nil, 'bt', env)))
local cmpls = {}
part = '^'..part