From 9cdaf41a724dd0d739611c698e92f4421a2fbafc Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 19 Nov 2012 00:28:48 -0500 Subject: Changed Lua code style for tables. --- core/args.lua | 2 +- core/events.lua | 36 ++++++++++++++++++------------------ core/file_io.lua | 4 ++-- core/gui.lua | 18 +++++++++--------- core/keys.lua | 4 ++-- core/locale.lua | 2 +- 6 files changed, 33 insertions(+), 33 deletions(-) (limited to 'core') diff --git a/core/args.lua b/core/args.lua index a7c56c90..1a410ba4 100644 --- a/core/args.lua +++ b/core/args.lua @@ -28,7 +28,7 @@ local switches = {} -- @param description Description of the switch for command line help. -- @name register function M.register(switch1, switch2, narg, f, description) - local t = { f, narg, description } + local t = {f, narg, description} switches[switch1], switches[switch2] = t, t end diff --git a/core/events.lua b/core/events.lua index f68b9fed..9139a30a 100644 --- a/core/events.lua +++ b/core/events.lua @@ -342,30 +342,30 @@ end --- Map of Scintilla notifications to their handlers. local c = _SCINTILLA.constants local scnotifications = { - [c.SCN_CHARADDED] = { 'char_added', 'ch' }, - [c.SCN_SAVEPOINTREACHED] = { 'save_point_reached' }, - [c.SCN_SAVEPOINTLEFT] = { 'save_point_left' }, - [c.SCN_DOUBLECLICK] = { 'double_click', 'position', 'line', 'modifiers' }, - [c.SCN_UPDATEUI] = { 'update_ui' }, - [c.SCN_MODIFIED] = { 'modified', 'modification_type' }, -- undocumented - [c.SCN_MARGINCLICK] = { 'margin_click', 'margin', 'position', 'modifiers' }, + [c.SCN_CHARADDED] = {'char_added', 'ch'}, + [c.SCN_SAVEPOINTREACHED] = {'save_point_reached'}, + [c.SCN_SAVEPOINTLEFT] = {'save_point_left'}, + [c.SCN_DOUBLECLICK] = {'double_click', 'position', 'line', 'modifiers'}, + [c.SCN_UPDATEUI] = {'update_ui'}, + [c.SCN_MODIFIED] = {'modified', 'modification_type'}, -- undocumented + [c.SCN_MARGINCLICK] = {'margin_click', 'margin', 'position', 'modifiers'}, [c.SCN_USERLISTSELECTION] = { 'user_list_selection', 'wParam', 'text', 'position' }, - [c.SCN_URIDROPPED] = { 'uri_dropped', 'text' }, - [c.SCN_DWELLSTART] = { 'dwell_start', 'position', 'x', 'y' }, - [c.SCN_DWELLEND] = { 'dwell_end', 'position', 'x', 'y' }, - [c.SCN_HOTSPOTCLICK] = { 'hotspot_click', 'position', 'modifiers' }, + [c.SCN_URIDROPPED] = {'uri_dropped', 'text'}, + [c.SCN_DWELLSTART] = {'dwell_start', 'position', 'x', 'y'}, + [c.SCN_DWELLEND] = {'dwell_end', 'position', 'x', 'y'}, + [c.SCN_HOTSPOTCLICK] = {'hotspot_click', 'position', 'modifiers'}, [c.SCN_HOTSPOTDOUBLECLICK] = { 'hotspot_double_click', 'position', 'modifiers' }, - [c.SCN_CALLTIPCLICK] = { 'call_tip_click', 'position' }, - [c.SCN_AUTOCSELECTION] = { 'auto_c_selection', 'text', 'position' }, - [c.SCN_INDICATORCLICK] = { 'indicator_click', 'position', 'modifiers' }, - [c.SCN_INDICATORRELEASE] = { 'indicator_release', 'position' }, - [c.SCN_AUTOCCANCELLED] = { 'auto_c_cancelled' }, - [c.SCN_AUTOCCHARDELETED] = { 'auto_c_char_deleted' }, - [c.SCN_HOTSPOTRELEASECLICK] = { 'hotspot_release_click', 'position' }, + [c.SCN_CALLTIPCLICK] = {'call_tip_click', 'position'}, + [c.SCN_AUTOCSELECTION] = {'auto_c_selection', 'text', 'position'}, + [c.SCN_INDICATORCLICK] = {'indicator_click', 'position', 'modifiers'}, + [c.SCN_INDICATORRELEASE] = {'indicator_release', 'position'}, + [c.SCN_AUTOCCANCELLED] = {'auto_c_cancelled'}, + [c.SCN_AUTOCCHARDELETED] = {'auto_c_char_deleted'}, + [c.SCN_HOTSPOTRELEASECLICK] = {'hotspot_release_click', 'position'}, } -- Handles Scintilla notifications. diff --git a/core/file_io.lua b/core/file_io.lua index 2582933c..3af44694 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -114,7 +114,7 @@ end -- [GNU iconv's encodings]: http://www.gnu.org/software/libiconv/ -- @class table -- @name try_encodings -io.try_encodings = { 'UTF-8', 'ASCII', 'ISO-8859-1', 'MacRoman' } +io.try_encodings = {'UTF-8', 'ASCII', 'ISO-8859-1', 'MacRoman'} --- -- Opens a list of files. @@ -375,6 +375,6 @@ end) -- @name open_recent_file function io.open_recent_file() local i = gui.filteredlist(_L['Open'], _L['File'], io.recent_files, true, - NCURSES and { '--width', gui.size[1] - 2 } or '') + NCURSES and {'--width', gui.size[1] - 2} or '') if i then io.open_file(io.recent_files[i + 1]) end end diff --git a/core/gui.lua b/core/gui.lua index 3e0db83e..635ea7d6 100644 --- a/core/gui.lua +++ b/core/gui.lua @@ -76,9 +76,9 @@ function gui.print(...) gui._print(_L['[Message Buffer]'], ...) end -- @param ... Additional parameters to pass to `gui.dialog()`. -- @return Either a string or integer on success; `nil` otherwise. In strings, -- multiple items are separated by newlines. --- @usage gui.filteredlist('Title', 'Foo', { 'Bar', 'Baz' }) --- @usage gui.filteredlist('Title', { 'Foo', 'Bar' }, { 'a', 'b', 'c', 'd' }, --- false, '--output-column', '2') +-- @usage gui.filteredlist('Title', 'Foo', {'Bar', 'Baz'}) +-- @usage gui.filteredlist('Title', {'Foo', 'Bar'}, {'a', 'b', 'c', 'd'}, false, +-- '--output-column', '2') -- @see dialog -- @name filteredlist function gui.filteredlist(title, columns, items, int_return, ...) @@ -103,7 +103,7 @@ end -- selected one, if any. -- @name switch_buffer function gui.switch_buffer() - local columns, items = { _L['Name'], _L['File'] }, {} + local columns, items = {_L['Name'], _L['File']}, {} for _, buffer in ipairs(_BUFFERS) do local filename = buffer.filename or buffer._type or _L['Untitled'] local basename = buffer.filename and filename:match('[^/\\]+$') or filename @@ -111,7 +111,7 @@ function gui.switch_buffer() items[#items + 1] = filename end local i = gui.filteredlist(_L['Switch Buffers'], columns, items, true, - NCURSES and { '--width', gui.size[1] - 2 } or '--') + NCURSES and {'--width', gui.size[1] - 2} or '--') if i then view:goto_buffer(i + 1) end end @@ -250,7 +250,7 @@ events_connect(events.VIEW_NEW, function() local ctrl_keys = { '[', ']', '/', '\\', 'Z', 'Y', 'X', 'C', 'V', 'A', 'L', 'T', 'D', 'U' } - local ctrl_shift_keys = { 'L', 'T', 'U', 'Z' } + local ctrl_shift_keys = {'L', 'T', 'U', 'Z'} for _, key in ipairs(ctrl_keys) do buffer:clear_cmd_key(string.byte(key), c.SCMOD_CTRL) end @@ -335,7 +335,7 @@ events_connect(events.APPLEEVENT_ODOC, function(uri) end) local string_format = string.format -local EOLs = { _L['CRLF'], _L['CR'], _L['LF'] } +local EOLs = {_L['CRLF'], _L['CR'], _L['LF']} local GETLEXERLANGUAGE = _SCINTILLA.properties.lexer_language[1] -- Sets docstatusbar text. events_connect(events.UPDATE_UI, function() @@ -494,8 +494,8 @@ local goto_view -- menu. '_' characters are treated as a menu mnemonics. If the menu item is -- empty, a menu separator item is created. Submenus are just nested -- menu-structure tables. Their title text is defined with a `title` key. --- @usage gui.menu{ { '_New', 1 }, { '_Open', 2 }, { '' }, { '_Quit', 4 } } --- @usage gui.menu{ { '_New', 1, string.byte('n'), 4 } } -- 'Ctrl+N' +-- @usage gui.menu{{'_New', 1}, {'_Open', 2}, {''}, {'_Quit', 4}} +-- @usage gui.menu{{'_New', 1, string.byte('n'), 4}} -- 'Ctrl+N' -- @see events.MENU_CLICKED -- @see _M.textadept.menu.set_menubar -- @see _M.textadept.menu.set_contextmenu diff --git a/core/keys.lua b/core/keys.lua index 6cd81953..ba1df7b4 100644 --- a/core/keys.lua +++ b/core/keys.lua @@ -58,7 +58,7 @@ local M = {} -- -- keys['cn'] = new_buffer -- keys['cs'] = buffer.save --- keys['a('] = { _M.textadept.editing.enclose, '(', ')' } +-- keys['a('] = {_M.textadept.editing.enclose, '(', ')'} -- -- Note that [`buffer`][] references are handled properly. -- @@ -75,7 +75,7 @@ local M = {} -- keys['aa'] = { -- a = function1, -- b = function2, --- c = { function3, arg1, arg2 } +-- c = {function3, arg1, arg2} -- } -- @field CLEAR (string) -- The string representing the key sequence that clears the current key chain. diff --git a/core/locale.lua b/core/locale.lua index 68a8266c..715e817e 100644 --- a/core/locale.lua +++ b/core/locale.lua @@ -33,4 +33,4 @@ for line in f:lines() do end f:close() -return setmetatable(M, { __index = function(t, k) return none..k end }) +return setmetatable(M, {__index = function(t, k) return none..k end}) -- cgit v1.2.3