From 03c4016d07477781aa3adcc9edf340c0bec9c6c8 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+orbitalquark@users.noreply.github.com> Date: Tue, 20 Oct 2020 15:29:03 -0400 Subject: Code cleanup. Of note: * io.save_all_files() does not visit each buffer to save anymore. An unintended side-effect was checking for outside modification (but only if the file itself was modified), so outside changes will always be saved over now. * The menu clicked handler uses assert_type(), so the 'Unknown command' localization is no longer needed. * When printing to a new buffer type would split the view, use an existing split view when possible. * Prefer 'goto continue' construct in loops over nested 'if's. * Fixed clearing of ui.find.replace_entry_text on reset in the GUI version. * Fixed lack of statusbar updating when setting options like buffer EOL mode, indentation, and encoding. * Renamed internal new_snippet() to new() and put it in the snippet metatable. --- modules/ansi_c/init.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'modules/ansi_c/init.lua') diff --git a/modules/ansi_c/init.lua b/modules/ansi_c/init.lua index 10a73ff6..3f5288c4 100644 --- a/modules/ansi_c/init.lua +++ b/modules/ansi_c/init.lua @@ -26,11 +26,7 @@ M.tags = { M.autocomplete_snippets = true local XPM = textadept.editing.XPM_IMAGES -local xpms = setmetatable({ - c = XPM.CLASS, d = XPM.SLOT, e = XPM.VARIABLE, f = XPM.METHOD, - g = XPM.TYPEDEF, m = XPM.VARIABLE, s = XPM.STRUCT, t = XPM.TYPEDEF, - v = XPM.VARIABLE -}, {__index = function() return 0 end}) +local xpms = setmetatable({c=XPM.CLASS,d=XPM.SLOT,e=XPM.VARIABLE,f=XPM.METHOD,g=XPM.TYPEDEF,m=XPM.VARIABLE,s=XPM.STRUCT,t=XPM.TYPEDEF,v=XPM.VARIABLE},{__index=function()return 0 end}) textadept.editing.autocompleters.ansi_c = function() -- Retrieve the symbol behind the caret. @@ -85,10 +81,9 @@ textadept.editing.autocompleters.ansi_c = function() return #part, list end -local api_files = textadept.editing.api_files -api_files.ansi_c[#api_files.ansi_c + 1] = _HOME .. '/modules/ansi_c/api' -api_files.ansi_c[#api_files.ansi_c + 1] = _HOME .. '/modules/ansi_c/lua_api' -api_files.ansi_c[#api_files.ansi_c + 1] = _USERHOME .. '/modules/ansi_c/api' +for _, tags in ipairs(M.tags) do + table.insert(textadept.editing.api_files.ansi_c, (tags:gsub('tags$', 'api'))) +end -- Commands. -- cgit v1.2.3