diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2014-10-29 09:23:58 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2014-10-29 09:23:58 -0400 |
commit | 9b4756a584c8dabd6db3fc41b8a892692074f9a2 (patch) | |
tree | 2c6f3ad2f5b8e74a0073961a7ad88209eb68aa1b /modules/ansi_c/init.lua | |
parent | 466b054ca5dc10ca61f32d287a98431adf5cd956 (diff) |
Fixed bug in ANSI C autocompletion; modules/ansi_c/init.lua
Diffstat (limited to 'modules/ansi_c/init.lua')
-rw-r--r-- | modules/ansi_c/init.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/modules/ansi_c/init.lua b/modules/ansi_c/init.lua index d96aa0e7..f9661ee7 100644 --- a/modules/ansi_c/init.lua +++ b/modules/ansi_c/init.lua @@ -38,11 +38,13 @@ textadept.editing.autocompleters.ansi_c = function() if symbol == '' and part == '' and op ~= '' then return nil end -- lone ., -> if op ~= '' and op ~= '.' and op ~= '->' then return nil end -- Attempt to identify the symbol type. - local buffer = buffer - local declaration = '([%w_]+)[%s%*&]+'..symbol:gsub('(%p)', '%%%1')..'[^%w_]' - for i = buffer:line_from_position(buffer.current_pos) - 1, 0, -1 do - local class = buffer:get_line(i):match(declaration) - if class then symbol = class break end + if symbol ~= '' then + local buffer = buffer + local declaration = '([%w_]+)[%s%*&]+'..symbol:gsub('(%p)', '%%%1')..'[^%w_]' + for i = buffer:line_from_position(buffer.current_pos) - 1, 0, -1 do + local class = buffer:get_line(i):match(declaration) + if class then symbol = class break end + end end -- Search through ctags for completions for that symbol. local name_patt = '^'..part |