diff options
author | 2013-04-29 16:13:59 -0400 | |
---|---|---|
committer | 2013-04-29 16:13:59 -0400 | |
commit | 78990df4f114c45adc7fd2678ffaedf0c4124d95 (patch) | |
tree | 9e79e8f93aa07ee9384b5ddd8cc548dc3c8ea20f /modules/textadept/command_entry.lua | |
parent | 8407377bbe3800dbc4706f584285b7a7858efabc (diff) | |
download | textadept-78990df4f114c45adc7fd2678ffaedf0c4124d95.tar.gz textadept-78990df4f114c45adc7fd2678ffaedf0c4124d95.zip |
More code cleanup.
"local buffer = buffer" and similar optimizations are not needed since lexing
the buffer is much more expensive and reaction time is limited by how fast the
keyboard can submit key presses.
Diffstat (limited to 'modules/textadept/command_entry.lua')
-rw-r--r-- | modules/textadept/command_entry.lua | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua index c4ab7b7a..a22b10c6 100644 --- a/modules/textadept/command_entry.lua +++ b/modules/textadept/command_entry.lua @@ -120,7 +120,7 @@ function M.complete_lua(code) local substring = (code or M.entry_text):match('[%w_.:]+$') or '' local path, op, prefix = substring:match('^([%w_.:]-)([.:]?)([%w_]*)$') local f, err = load('return ('..path..')', nil, 'bt', env) - local ok, tbl = pcall(f) + local ok, result = pcall(f) local cmpls = {} prefix = '^'..prefix if not ok then -- shorthand notation @@ -136,8 +136,8 @@ function M.complete_lua(code) if p:find(prefix) then cmpls[#cmpls + 1] = p end end else - if type(tbl) ~= 'table' then return end - for k in pairs(tbl) do + if type(result) ~= 'table' then return end + for k in pairs(result) do if type(k) == 'string' and k:find(prefix) then cmpls[#cmpls + 1] = k end end if path == 'buffer' and op == ':' then @@ -152,10 +152,8 @@ function M.complete_lua(code) end table.sort(cmpls) M.show_completions(cmpls) - return true end -local events = events -- Pass command entry keys to the default keypress handler. -- Since the command entry is designed to be modal, command entry key bindings -- should stay separate from editor key bindings. |