From 9b4756a584c8dabd6db3fc41b8a892692074f9a2 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Wed, 29 Oct 2014 09:23:58 -0400 Subject: Fixed bug in ANSI C autocompletion; modules/ansi_c/init.lua --- modules/ansi_c/init.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'modules/ansi_c') 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 -- cgit v1.2.3