aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/adeptsense.lua4
-rw-r--r--modules/textadept/bookmarks.lua2
-rw-r--r--modules/textadept/command_entry.lua28
-rw-r--r--modules/textadept/editing.lua36
-rw-r--r--modules/textadept/file_types.lua2
-rw-r--r--modules/textadept/find.lua52
-rw-r--r--modules/textadept/keys.lua44
-rw-r--r--modules/textadept/menu.lua58
-rw-r--r--modules/textadept/run.lua8
-rw-r--r--modules/textadept/session.lua48
-rw-r--r--modules/textadept/snippets.lua8
11 files changed, 144 insertions, 146 deletions
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua
index 8a32f290..dd98c052 100644
--- a/modules/textadept/adeptsense.lua
+++ b/modules/textadept/adeptsense.lua
@@ -818,8 +818,8 @@ function M.goto_ctag(sense, kind, title)
if kind == M.FUNCTION or kind == M.FIELD then
table.insert(columns, 2, 'Class')
end
- local location = gui.filteredlist(title, columns, items, false,
- '--output-column', '3')
+ local location = ui.filteredlist(title, columns, items, false,
+ '--output-column', '3')
if not location then return end
local path, line = location:match('^(%a?:?[^:]+):(.+)$')
io.open_file(path)
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua
index e1d84ea0..e0031610 100644
--- a/modules/textadept/bookmarks.lua
+++ b/modules/textadept/bookmarks.lua
@@ -54,7 +54,7 @@ function M.goto_mark(next)
marks[#marks + 1] = tostring(line + 1)..': '..text
line = buffer:marker_next(line + 1, 2^MARK_BOOKMARK)
until line < 0
- local line = gui.filteredlist(_L['Select Bookmark'], _L['Bookmark'], marks)
+ local line = ui.filteredlist(_L['Select Bookmark'], _L['Bookmark'], marks)
if line then _M.textadept.editing.goto_line(line:match('^%d+')) end
else
local f = next and buffer.marker_next or buffer.marker_previous
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index 4825faa9..7d9783bb 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -1,7 +1,7 @@
-- Copyright 2007-2013 Mitchell mitchell.att.foicica.com. See LICENSE.
-- Abbreviated environment and commands from Jay Gould.
-local M = gui.command_entry
+local M = ui.command_entry
--[[ This comment is for LuaDoc.
---
@@ -16,11 +16,11 @@ local M = gui.command_entry
-- for looking up key bindings. An example mode is "lua_command" mode for
-- executing Lua commands:
--
--- local gui_ce = gui.command_entry
--- keys['ce'] = {gui_ce.enter_mode, 'lua_command'}
+-- local ui_ce = ui.command_entry
+-- keys['ce'] = {ui_ce.enter_mode, 'lua_command'}
-- keys.lua_command = {
--- ['\t'] = gui_ce.complete_lua,
--- ['\n'] = {gui_ce.finish_mode, gui_ce.execute_lua}
+-- ['\t'] = ui_ce.complete_lua,
+-- ['\n'] = {ui_ce.finish_mode, ui_ce.execute_lua}
-- }
--
-- In this case, `Ctrl+E` opens the command entry and enters "lua_command" key
@@ -33,7 +33,7 @@ local M = gui.command_entry
-- [modes]: keys.html#Modes
-- @field entry_text (string)
-- The text in the entry.
-module('gui.command_entry')]]
+module('ui.command_entry')]]
---
-- Opens the command entry in key mode *mode*.
@@ -42,7 +42,7 @@ module('gui.command_entry')]]
-- command entry, and restores normal key lookup.
-- This function is useful for binding keys to enter a command entry mode.
-- @param mode The key mode to enter into, or `nil` to exit the current mode.
--- @usage keys['ce'] = {gui.command_entry.enter_mode, 'command_entry'}
+-- @usage keys['ce'] = {ui.command_entry.enter_mode, 'command_entry'}
-- @see _G.keys.MODE
-- @name enter_mode
function M.enter_mode(mode)
@@ -61,7 +61,7 @@ end
-- action with the entered text.
-- @param f Optional function to call. It should accept the command entry text
-- as an argument.
--- @usage keys['\n'] = {gui.command_entry.finish_mode, gui.print}
+-- @usage keys['\n'] = {ui.command_entry.finish_mode, ui.print}
-- @name finish_mode
function M.finish_mode(f)
M.enter_mode(nil)
@@ -78,12 +78,12 @@ local env = setmetatable({}, {
if f and type(f) == 'function' then
f = function(...) buffer[k](buffer, ...) end
elseif f == nil then
- f = view[k] or gui[k] or _G[k]
+ f = view[k] or ui[k] or _G[k]
end
return f
end,
__newindex = function(t, k, v)
- for _, t2 in ipairs{buffer, view, gui} do
+ for _, t2 in ipairs{buffer, view, ui} do
if t2[k] ~= nil then t2[k] = v return end
end
rawset(t, k, v)
@@ -93,7 +93,7 @@ local env = setmetatable({}, {
---
-- Executes string *code* as Lua code.
-- Code is subject to an "abbreviated" environment where the `buffer`, `view`,
--- and `gui` tables are also considered as globals.
+-- and `ui` tables are also considered as globals.
-- Prints the results of '=' expressions like in the Lua prompt.
-- @param code The Lua code to execute.
-- @name execute_lua
@@ -102,7 +102,7 @@ function M.execute_lua(code)
local f, err = load(code, nil, 'bt', env)
if err then error(err) end
local result = f()
- if result ~= nil then gui.print(result) end
+ if result ~= nil then ui.print(result) end
events.emit(events.UPDATE_UI)
end
args.register('-e', '--execute', 1, M.execute_lua, 'Execute Lua code')
@@ -110,7 +110,7 @@ args.register('-e', '--execute', 1, M.execute_lua, 'Execute Lua code')
---
-- Shows a set of Lua code completions for string *code* or `entry_text`.
-- Completions are subject to an "abbreviated" environment where the `buffer`,
--- `view`, and `gui` tables are also considered as globals.
+-- `view`, and `ui` tables are also considered as globals.
-- @param code The Lua code to complete. The default value is the value of
-- `entry_text`.
-- @name complete_lua
@@ -122,7 +122,7 @@ function M.complete_lua(code)
local cmpls = {}
prefix = '^'..prefix
if not ok then -- shorthand notation
- for _, t in ipairs{buffer, view, gui, _G} do
+ for _, t in ipairs{buffer, view, ui, _G} do
for k in pairs(t) do
if type(k) == 'string' and k:find(prefix) then cmpls[#cmpls + 1] = k end
end
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 19d3587c..897384c2 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -184,7 +184,7 @@ events.connect(events.FILE_BEFORE_SAVE, function()
end)
---
--- Goes to the current character's matching brace, selecting the text in-between
+-- Goes to the current character's matching brace, selecting the text in between
-- if *select* is `true`.
-- @param select Optional flag indicating whether or not to select the text
-- between matching braces. The default value is `false`.
@@ -314,12 +314,12 @@ end
-- @name goto_line
function M.goto_line(line)
if not line then
- line = tonumber(gui.dialog('inputbox',
- '--title', _L['Go To'],
- '--text', _L['Line Number:'],
- '--button1', _L['_OK'],
- '--button2', _L['_Cancel'],
- '--no-newline'):match('%-?%d+$'))
+ line = tonumber(ui.dialog('inputbox',
+ '--title', _L['Go To'],
+ '--text', _L['Line Number:'],
+ '--button1', _L['_OK'],
+ '--button2', _L['_Cancel'],
+ '--no-newline'):match('%-?%d+$'))
if not line or line < 0 then return end
end
buffer:ensure_visible_enforce_policy(line - 1)
@@ -371,9 +371,8 @@ function M.enclose(left, right)
end
---
--- Selects the text in-between strings *left* and *right* containing the caret.
--- If already selected, toggles between selecting the *left* and *right*
--- enclosures too.
+-- Selects the text between strings *left* and *right* containing the caret.
+-- If already selected, toggles between selecting *left* and *right* too.
-- @param left The left part of the enclosure.
-- @param right The right part of the enclosure.
-- @name select_enclosed
@@ -440,8 +439,7 @@ function M.select_indented_block()
end
---
--- Converts indentation between tabs and spaces depending on the buffer's
--- indentation settings.
+-- Converts indentation between tabs and spaces based on `buffer.use_tabs`.
-- If `buffer.use_tabs` is `true`, `buffer.tab_width` indenting spaces are
-- converted to tabs. Otherwise, all indenting tabs are converted to
-- `buffer.tab_width` spaces.
@@ -515,9 +513,9 @@ if buffer then set_highlight_properties() end
events.connect(events.VIEW_NEW, set_highlight_properties)
---
--- Passes selected or all buffer text to string shell command *cmd* as standard
--- input (stdin) and replaces the input text with the command's standard output
--- (stdout).
+-- Passes selected or all buffer text to string shell command *command* as
+-- standard input (stdin) and replaces the input text with the command's
+-- standard output (stdout).
-- Standard input is as follows:
--
-- 1. If text is selected and spans multiple lines, all text on the lines
@@ -527,10 +525,10 @@ events.connect(events.VIEW_NEW, set_highlight_properties)
-- 2. If text is selected and spans a single line, only the selected text is
-- used.
-- 3. If no text is selected, the entire buffer is used.
--- @param cmd The Linux, BSD, Mac OSX, or Windows shell command to filter text
--- through.
+-- @param command The Linux, BSD, Mac OSX, or Windows shell command to filter
+-- text through.
-- @name filter_through
-function M.filter_through(cmd)
+function M.filter_through(command)
local s, e = buffer.selection_start, buffer.selection_end
local input
if s ~= e then -- use selected lines as input
@@ -547,7 +545,7 @@ function M.filter_through(cmd)
local f = io.open(tmpfile, 'wb')
f:write(input)
f:close()
- local cmd = (not WIN32 and 'cat' or 'type')..' "'..tmpfile..'" | '..cmd
+ local cmd = (not WIN32 and 'cat' or 'type')..' "'..tmpfile..'" | '..command
if WIN32 then cmd = cmd:gsub('/', '\\') end
local p = io.popen(cmd)
if s ~= e then
diff --git a/modules/textadept/file_types.lua b/modules/textadept/file_types.lua
index f54742f8..1d57070b 100644
--- a/modules/textadept/file_types.lua
+++ b/modules/textadept/file_types.lua
@@ -128,7 +128,7 @@ events.connect(events.RESET_AFTER, restore_lexer)
-- @see buffer.set_lexer
-- @name select_lexer
function M.select_lexer()
- local lexer = gui.filteredlist(_L['Select Lexer'], _L['Name'], M.lexers)
+ local lexer = ui.filteredlist(_L['Select Lexer'], _L['Name'], M.lexers)
if lexer then buffer:set_lexer(lexer) end
end
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index cb0bd449..d4422963 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -1,6 +1,6 @@
-- Copyright 2007-2013 Mitchell mitchell.att.foicica.com. See LICENSE.
-local M = gui.find
+local M = ui.find
--[[ This comment is for LuaDoc.
---
@@ -57,7 +57,7 @@ local M = gui.find
-- previous occurrence.
-- This is useful for implementing a more visual or audible notice when a
-- search wraps in addition to the statusbar message.
-module('gui.find')]]
+module('ui.find')]]
local _L = _L
M.find_label_text = not CURSES and _L['_Find:'] or _L['Find:']
@@ -154,16 +154,16 @@ local function find_(text, next, flags, no_wrap, wrapped)
if pos == -1 and not no_wrap then
local anchor, pos = buffer.anchor, buffer.current_pos
buffer:goto_pos(next and 0 or buffer.length)
- gui.statusbar_text = _L['Search wrapped']
+ ui.statusbar_text = _L['Search wrapped']
events.emit(events.FIND_WRAPPED)
pos = find_(text, next, flags, true, true)
if pos == -1 then
- gui.statusbar_text = _L['No results found']
+ ui.statusbar_text = _L['No results found']
buffer:line_scroll(0, first_visible_line - buffer.first_visible_line)
buffer:goto_pos(anchor)
end
elseif not wrapped then
- gui.statusbar_text = ''
+ ui.statusbar_text = ''
end
return pos
@@ -203,8 +203,8 @@ end
function M.find_incremental(text, next, anchor)
if text then find_incremental(text, next, anchor) return end
M.incremental_start = buffer.current_pos
- gui.command_entry.entry_text = ''
- gui.command_entry.enter_mode('find_incremental')
+ ui.command_entry.entry_text = ''
+ ui.command_entry.enter_mode('find_incremental')
end
---
@@ -219,12 +219,12 @@ end
-- @name find_in_files
function M.find_in_files(utf8_dir)
if not utf8_dir then
- utf8_dir = gui.dialog('fileselect',
- '--title', _L['Find in Files'],
- '--select-only-directories',
- '--with-directory',
- (buffer.filename or ''):match('^.+[/\\]') or '',
- '--no-newline')
+ utf8_dir = ui.dialog('fileselect',
+ '--title', _L['Find in Files'],
+ '--select-only-directories',
+ '--with-directory',
+ (buffer.filename or ''):match('^.+[/\\]') or '',
+ '--no-newline')
end
if utf8_dir == '' then return end
@@ -247,7 +247,7 @@ function M.find_in_files(utf8_dir)
if #matches == 1 then matches[2] = _L['No results found'] end
matches[#matches + 1] = ''
if buffer._type ~= _L['[Files Found Buffer]'] then preferred_view = view end
- gui._print(_L['[Files Found Buffer]'], table.concat(matches, '\n'))
+ ui._print(_L['[Files Found Buffer]'], table.concat(matches, '\n'))
end
-- Replaces found text.
@@ -278,15 +278,15 @@ local function replace(rtext)
buffer:replace_target(rtext:gsub('\\[abfnrtv\\]', escapes))
buffer:goto_pos(buffer.target_end) -- 'find' text after this replacement
else
- gui.dialog('ok-msgbox',
- '--title', _L['Error'],
- '--text', _L['An error occured:'],
- '--informative-text',
- rtext:match(':1:(.+)$') or rtext:match(':%d+:(.+)$'),
- '--icon', 'gtk-dialog-error',
- '--button1', _L['_OK'],
- '--button2', _L['_Cancel'],
- '--no-cancel')
+ ui.dialog('ok-msgbox',
+ '--title', _L['Error'],
+ '--text', _L['An error occured:'],
+ '--informative-text',
+ rtext:match(':1:(.+)$') or rtext:match(':%d+:(.+)$'),
+ '--icon', 'gtk-dialog-error',
+ '--button1', _L['_OK'],
+ '--button2', _L['_Cancel'],
+ '--no-cancel')
-- Since find is called after replace returns, have it 'find' the current
-- text again, rather than the next occurance so the user can fix the error.
buffer:goto_pos(buffer.current_pos)
@@ -327,7 +327,7 @@ local function replace_all(ftext, rtext)
buffer:set_sel(s, e > 0 and e or buffer.length)
buffer:indicator_clear_range(e, 1)
end
- gui.statusbar_text = ("%d %s"):format(count, _L['replacement(s) made'])
+ ui.statusbar_text = ("%d %s"):format(count, _L['replacement(s) made'])
buffer:end_undo_action()
end
events.connect(events.REPLACE_ALL, replace_all)
@@ -352,7 +352,7 @@ function M.goto_file_found(line, next)
if is_ff_buf(_BUFFERS[i]) then ff_buf = i break end
end
if not ff_view and not ff_buf then return end
- if ff_view then gui.goto_view(ff_view) else view:goto_buffer(ff_buf) end
+ if ff_view then ui.goto_view(ff_view) else view:goto_buffer(ff_buf) end
-- If not line was given, find the next search result.
if not line and next ~= nil then
@@ -374,7 +374,7 @@ function M.goto_file_found(line, next)
local file, line_num = buffer:get_cur_line():match('^(.+):(%d+):.+$')
if not file then if CURSES then view:goto_buffer(cur_buf) end return end
_M.textadept.editing.select_line()
- gui.goto_file(file, true, preferred_view)
+ ui.goto_file(file, true, preferred_view)
_M.textadept.editing.goto_line(line_num)
end
events.connect(events.DOUBLE_CLICK, function(pos, line)
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index c81f3602..0e1f4206 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -230,8 +230,8 @@ M.utils = {
buffer:insert_text(-1, '</'..buffer:text_range(pos, buffer.current_pos))
end,
find_in_files = function()
- gui.find.in_files = true
- gui.find.focus()
+ ui.find.in_files = true
+ ui.find.focus()
end,
select_command = function() _M.textadept.menu.select_command() end,
snapopen_filedir = function()
@@ -399,7 +399,7 @@ keys[not OSX and not CURSES and 'c/' or 'm/'] = m_editing.block_comment
keys.ct = m_editing.transpose_chars
keys[not OSX and (not CURSES and 'cJ' or 'mj') or 'cj'] = m_editing.join_lines
keys[not OSX and (not CURSES and 'c|' or 'c\\')
- or 'm|'] = {gui.command_entry.enter_mode, 'filter_through'}
+ or 'm|'] = {ui.command_entry.enter_mode, 'filter_through'}
-- Select.
keys[not CURSES and 'cM' or 'mM'] = {m_editing.match_brace, 'select'}
keys[not OSX and not CURSES and 'c<'
@@ -441,30 +441,30 @@ keys.csup = buffer.move_selected_lines_up
keys.csdown = buffer.move_selected_lines_down
-- Search.
-keys[not OSX and not CURSES and 'cf' or 'mf'] = gui.find.focus
+keys[not OSX and not CURSES and 'cf' or 'mf'] = ui.find.focus
if CURSES then keys.mF = keys.mf end -- in case mf is used by GUI terminals
-keys[not OSX and not CURSES and 'cg' or 'mg'] = gui.find.find_next
+keys[not OSX and not CURSES and 'cg' or 'mg'] = ui.find.find_next
if not OSX and not CURSES then keys.f3 = keys.cg end
-keys[not OSX and not CURSES and 'cG' or 'mG'] = gui.find.find_prev
+keys[not OSX and not CURSES and 'cG' or 'mG'] = ui.find.find_prev
if not OSX and not CURSES then keys.sf3 = keys.cG end
-keys[not OSX and (not CURSES and 'car' or 'mr') or 'cr'] = gui.find.replace
-keys[not OSX and (not CURSES and 'caR' or 'mR') or 'cR'] = gui.find.replace_all
+keys[not OSX and (not CURSES and 'car' or 'mr') or 'cr'] = ui.find.replace
+keys[not OSX and (not CURSES and 'caR' or 'mR') or 'cR'] = ui.find.replace_all
-- Find Next is an when find pane is focused in GUI.
-- Find Prev is ap when find pane is focused in GUI.
-- Replace is ar when find pane is focused in GUI.
-- Replace All is aa when find pane is focused in GUI.
-keys[not OSX and not CURSES and 'caf' or 'cmf'] = gui.find.find_incremental
+keys[not OSX and not CURSES and 'caf' or 'cmf'] = ui.find.find_incremental
if not CURSES then keys[not OSX and 'cF' or 'mF'] = utils.find_in_files end
-- Find in Files is ai when find pane is focused in GUI.
if not CURSES then
- keys[not OSX and 'cag' or 'cmg'] = {gui.find.goto_file_found, false, true}
- keys[not OSX and 'caG' or 'cmG'] = {gui.find.goto_file_found, false, false}
+ keys[not OSX and 'cag' or 'cmg'] = {ui.find.goto_file_found, false, true}
+ keys[not OSX and 'caG' or 'cmG'] = {ui.find.goto_file_found, false, false}
end
keys[not OSX and 'cj' or 'mj'] = m_editing.goto_line
-- Tools.
keys[not OSX and (not CURSES and 'ce' or 'mc')
- or 'me'] = {gui.command_entry.enter_mode, 'lua_command'}
+ or 'me'] = {ui.command_entry.enter_mode, 'lua_command'}
keys[not OSX and (not CURSES and 'cE' or 'mC') or 'mE'] = utils.select_command
keys[not OSX and 'cr' or 'mr'] = _M.textadept.run.run
keys[not OSX and (not CURSES and 'cR' or 'cmr')
@@ -503,7 +503,7 @@ if not CURSES then keys[not OSX and 'ci' or 'mi'] = utils.show_style end
-- Buffer.
keys[not CURSES and 'c\t' or 'mn'] = {view.goto_buffer, view, 1, true}
keys[not CURSES and 'cs\t' or 'mp'] = {view.goto_buffer, view, -1, true}
-keys[not OSX and not CURSES and 'cb' or 'mb'] = gui.switch_buffer
+keys[not OSX and not CURSES and 'cb' or 'mb'] = ui.switch_buffer
if CURSES then keys.mB = keys.mb end -- in case mb is used by GUI terminals
-- Indentation.
-- TODO: {utils.set_indentation, 2}
@@ -532,8 +532,8 @@ if CURSES then keys.cl = keys.f5 end
-- View.
if not CURSES then
- keys[not OSX and 'can' or 'ca\t'] = {gui.goto_view, 1, true}
- keys[not OSX and 'cap' or 'cas\t'] = {gui.goto_view, -1, true}
+ keys[not OSX and 'can' or 'ca\t'] = {ui.goto_view, 1, true}
+ keys[not OSX and 'cap' or 'cas\t'] = {ui.goto_view, -1, true}
keys[not OSX and 'cas' or 'cs'] = {view.split, view}
if not OSX then keys.cah = keys.cas end
keys[not OSX and 'cav' or 'cv'] = {view.split, view, true}
@@ -596,28 +596,28 @@ end
-- Modes.
keys.lua_command = {
- ['\t'] = gui.command_entry.complete_lua,
- ['\n'] = {gui.command_entry.finish_mode, gui.command_entry.execute_lua}
+ ['\t'] = ui.command_entry.complete_lua,
+ ['\n'] = {ui.command_entry.finish_mode, ui.command_entry.execute_lua}
}
keys.filter_through = {
- ['\n'] = {gui.command_entry.finish_mode, m_editing.filter_through},
+ ['\n'] = {ui.command_entry.finish_mode, m_editing.filter_through},
}
keys.find_incremental = {
['\n'] = function()
- gui.find.find_incremental(gui.command_entry.entry_text, true, true)
+ ui.find.find_incremental(ui.command_entry.entry_text, true, true)
end,
['cr'] = function()
- gui.find.find_incremental(gui.command_entry.entry_text, false, true)
+ ui.find.find_incremental(ui.command_entry.entry_text, false, true)
end,
['\b'] = function()
- gui.find.find_incremental(gui.command_entry.entry_text:sub(1, -2), true)
+ ui.find.find_incremental(ui.command_entry.entry_text:sub(1, -2), true)
return false -- propagate
end
}
-- Add the character for any key pressed without modifiers to incremental find.
setmetatable(keys.find_incremental, {__index = function(t, k)
if #k > 1 and k:find('^[cams]*.+$') then return end
- gui.find.find_incremental(gui.command_entry.entry_text..k, true)
+ ui.find.find_incremental(ui.command_entry.entry_text..k, true)
end})
return M
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index b0cc2953..3997375b 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -51,7 +51,7 @@ local menubar = {
{_L['Toggle _Block Comment'], m_editing.block_comment},
{_L['T_ranspose Characters'], m_editing.transpose_chars},
{_L['_Join Lines'], m_editing.join_lines},
- {_L['_Filter Through'], {gui.command_entry.enter_mode, 'filter_through'}},
+ {_L['_Filter Through'], {ui.command_entry.enter_mode, 'filter_through'}},
{ title = _L['_Select'],
{_L['Select to _Matching Brace'], {m_editing.match_brace, 'select'}},
{_L['Select between _XML Tags'], {m_editing.select_enclosed, '>', '<'}},
@@ -83,21 +83,21 @@ local menubar = {
},
},
{ title = _L['_Search'],
- {_L['_Find'], gui.find.focus},
- {_L['Find _Next'], gui.find.find_next},
- {_L['Find _Previous'], gui.find.find_prev},
- {_L['_Replace'], gui.find.replace},
- {_L['Replace _All'], gui.find.replace_all},
- {_L['Find _Incremental'], gui.find.find_incremental},
+ {_L['_Find'], ui.find.focus},
+ {_L['Find _Next'], ui.find.find_next},
+ {_L['Find _Previous'], ui.find.find_prev},
+ {_L['_Replace'], ui.find.replace},
+ {_L['Replace _All'], ui.find.replace_all},
+ {_L['Find _Incremental'], ui.find.find_incremental},
SEPARATOR,
{_L['Find in Fi_les'], utils.find_in_files},
- {_L['Goto Nex_t File Found'], {gui.find.goto_file_found, false, true}},
- {_L['Goto Previou_s File Found'], {gui.find.goto_file_found, false, false}},
+ {_L['Goto Nex_t File Found'], {ui.find.goto_file_found, false, true}},
+ {_L['Goto Previou_s File Found'], {ui.find.goto_file_found, false, false}},
SEPARATOR,
{_L['_Jump to'], m_editing.goto_line},
},
{ title = _L['_Tools'],
- {_L['Command _Entry'], {gui.command_entry.enter_mode, 'lua_command'}},
+ {_L['Command _Entry'], {ui.command_entry.enter_mode, 'lua_command'}},
{_L['Select Co_mmand'], utils.select_command},
SEPARATOR,
{_L['_Run'], _M.textadept.run.run},
@@ -133,7 +133,7 @@ local menubar = {
{ title = _L['_Buffer'],
{_L['_Next Buffer'], {view.goto_buffer, view, 1, true}},
{_L['_Previous Buffer'], {view.goto_buffer, view, -1, true}},
- {_L['_Switch to Buffer...'], gui.switch_buffer},
+ {_L['_Switch to Buffer...'], ui.switch_buffer},
SEPARATOR,
{ title = _L['_Indentation'],
{_L['Tab width: _2'], {utils.set_indentation, 2}},
@@ -161,8 +161,8 @@ local menubar = {
{_L['_Refresh Syntax Highlighting'], {buffer.colourise, buffer, 0, -1}},
},
{ title = _L['_View'],
- {_L['_Next View'], {gui.goto_view, 1, true}},
- {_L['_Previous View'], {gui.goto_view, -1, true}},
+ {_L['_Next View'], {ui.goto_view, 1, true}},
+ {_L['_Previous View'], {ui.goto_view, -1, true}},
SEPARATOR,
{_L['Split View _Horizontal'], {view.split, view}},
{_L['Split View _Vertical'], {view.split, view, true}},
@@ -192,7 +192,7 @@ local menubar = {
{_L['Show _LuaDoc'], {utils.open_webpage, _HOME..'/doc/api/index.html'}},
SEPARATOR,
{_L['_About'],
- {gui.dialog, 'ok-msgbox', '--title', 'Textadept', '--text', _RELEASE,
+ {ui.dialog, 'ok-msgbox', '--title', 'Textadept', '--text', _RELEASE,
'--informative-text', 'Copyright © 2007-2013 Mitchell. See LICENSE\n'..
'http://foicica.com/textadept', '--button1', _L['_OK'], '--no-cancel',
'--icon-file', _HOME..'/core/images/ta_64x64.png'}},
@@ -247,13 +247,13 @@ end
local key_shortcuts, menu_actions, contextmenu_actions
--- Creates a menu suitable for `gui.menu()` from the menu table format.
+-- Creates a menu suitable for `ui.menu()` from the menu table format.
-- Also assigns key commands.
-- @param menu The menu to create a GTK+ menu from.
-- @param contextmenu Flag indicating whether or not the menu is a context menu.
-- If so, menu_id offset is 1000. The default value is `false`.
--- @return GTK+ menu that can be passed to `gui.menu()`.
--- @see gui.menu
+-- @return GTK+ menu that can be passed to `ui.menu()`.
+-- @see ui.menu
local function read_menu_table(menu, contextmenu)
local gtkmenu = {}
gtkmenu.title = menu.title
@@ -297,15 +297,15 @@ end
local items, commands
---
--- Sets `gui.menubar` from *menubar*, a table of menus.
+-- Sets `ui.menubar` from *menubar*, a table of menus.
-- Each menu is an ordered list of menu items and has a `title` key for the
-- title text. Menu items are tables containing menu text and either a function
-- to call or a table containing a function with its parameters to call when an
-- item is clicked. Menu items may also be sub-menus, ordered lists of menu
-- items with an additional `title` key for the sub-menu's title text.
-- @param menubar The table of menu tables to create the menubar from.
--- @see gui.menubar
--- @see gui.menu
+-- @see ui.menubar
+-- @see ui.menu
-- @name set_menubar
function M.set_menubar(menubar)
key_shortcuts = {}
@@ -313,27 +313,27 @@ function M.set_menubar(menubar)
menu_actions = {}
local _menubar = {}
for i = 1, #menubar do
- _menubar[#_menubar + 1] = gui.menu(read_menu_table(menubar[i]))
+ _menubar[#_menubar + 1] = ui.menu(read_menu_table(menubar[i]))
end
- gui.menubar = _menubar
+ ui.menubar = _menubar
items, commands = {}, {}
build_command_tables(menubar, nil, items, commands)
end
M.set_menubar(menubar)
---
--- Sets `gui.context_menu` from *menu*, an ordered list of menu items.
+-- Sets `ui.context_menu` from *menu*, an ordered list of menu items.
-- Menu items are tables containing menu text and either a function to call or
-- a table containing a function with its parameters to call when an item is
-- clicked. Menu items may also be sub-menus, ordered lists of menu items with
-- an additional `title` key for the sub-menu's title text.
-- @param menu The menu table to create the context menu from.
--- @see gui.context_menu
--- @see gui.menu
+-- @see ui.context_menu
+-- @see ui.menu
-- @name set_contextmenu
function M.set_contextmenu(menu)
contextmenu_actions = {}
- gui.context_menu = gui.menu(read_menu_table(menu, true))
+ ui.context_menu = ui.menu(read_menu_table(menu, true))
end
if not CURSES then M.set_contextmenu(context_menu) end
@@ -341,9 +341,9 @@ if not CURSES then M.set_contextmenu(context_menu) end
-- Prompts the user to select a menu command to run.
-- @name select_command
function M.select_command()
- local i = gui.filteredlist(_L['Run Command'],
- {_L['Command'], _L['Key Command']}, items, true,
- CURSES and {'--width', gui.size[1] - 2} or '')
+ local i = ui.filteredlist(_L['Run Command'],
+ {_L['Command'], _L['Key Command']}, items, true,
+ CURSES and {'--width', ui.size[1] - 2} or '')
if i then keys.run_command(commands[i + 1], type(commands[i + 1])) end
end
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 7e0dc83b..38a5e0f4 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -106,9 +106,9 @@ local MARK_ERROR = _SCINTILLA.next_marker_number()
-- @param lexer The current lexer.
-- @param output The output to print.
local function print_output(lexer, output)
- gui.print(output)
+ ui.print(output)
if get_error_details(output) then
- -- Current position is one line below the error due to gui.print()'s '\n'.
+ -- Current position is one line below the error due to ui.print()'s '\n'.
buffer:marker_add(buffer.line_count - 2, MARK_ERROR)
end
end
@@ -214,7 +214,7 @@ function M.goto_error(line, next)
if is_msg_buf(_BUFFERS[i]) then msg_buf = i break end
end
if not msg_view and not msg_buf then return end
- if msg_view then gui.goto_view(msg_view) else view:goto_buffer(msg_buf) end
+ if msg_view then ui.goto_view(msg_view) else view:goto_buffer(msg_buf) end
-- If no line was given, find the next error marker.
if not line and next ~= nil then
@@ -232,7 +232,7 @@ function M.goto_error(line, next)
local err = get_error_details(buffer:get_line(line))
if not err then if CURSES then view:goto_buffer(cur_buf) end return end
_M.textadept.editing.select_line()
- gui.goto_file(M.cwd..err.filename, true, preferred_view, true)
+ ui.goto_file(M.cwd..err.filename, true, preferred_view, true)
local line, message = err.line, err.message
buffer:goto_line(line - 1)
if message then
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index d9783512..3aca6453 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -40,13 +40,13 @@ M.MAX_RECENT_FILES = 10
-- @see DEFAULT_SESSION
-- @name load
function M.load(filename)
- filename = filename or gui.dialog('fileselect',
- '--title', _L['Load Session'],
- '--with-directory',
- M.DEFAULT_SESSION:match('.+[/\\]') or '',
- '--with-file',
- M.DEFAULT_SESSION:match('[^/\\]+$') or '',
- '--no-newline'):iconv(_CHARSET, 'UTF-8')
+ filename = filename or ui.dialog('fileselect',
+ '--title', _L['Load Session'],
+ '--with-directory',
+ M.DEFAULT_SESSION:match('.+[/\\]') or '',
+ '--with-file',
+ M.DEFAULT_SESSION:match('[^/\\]+$') or '',
+ '--no-newline'):iconv(_CHARSET, 'UTF-8')
if filename == '' then return end
local not_found = {}
local f = io.open(filename, 'rb')
@@ -91,7 +91,7 @@ function M.load(filename)
elseif line:find('^size:') then
local maximized, width, height = line:match('^size: (%l*) ?(%d+) (%d+)$')
maximized = maximized == 'true'
- if maximized then gui.maximized = true else gui.size = {width, height} end
+ if maximized then ui.maximized = true else ui.size = {width, height} end
elseif line:find('^recent:') then
local filename = line:match('^recent: (.+)$')
local recent, exists = io.recent_files, false
@@ -102,14 +102,14 @@ function M.load(filename)
end
end
f:close()
- gui.goto_view(current_view)
+ ui.goto_view(current_view)
if #not_found > 0 then
- gui.dialog('msgbox',
- '--title', _L['Session Files Not Found'],
- '--text', _L['The following session files were not found'],
- '--informative-text', table.concat(not_found, '\n'),
- '--icon', 'gtk-dialog-warning',
- '--button1', _L['_OK'])
+ ui.dialog('msgbox',
+ '--title', _L['Session Files Not Found'],
+ '--text', _L['The following session files were not found'],
+ '--informative-text', table.concat(not_found, '\n'),
+ '--icon', 'gtk-dialog-warning',
+ '--button1', _L['_OK'])
end
return true
end
@@ -127,13 +127,13 @@ end)
-- @see DEFAULT_SESSION
-- @name save
function M.save(filename)
- filename = filename or gui.dialog('filesave',
- '--title', _L['Save Session'],
- '--with-directory',
- M.DEFAULT_SESSION:match('.+[/\\]') or '',
- '--with-file',
- M.DEFAULT_SESSION:match('[^/\\]+$') or '',
- '--no-newline'):iconv(_CHARSET, 'UTF-8')
+ filename = filename or ui.dialog('filesave',
+ '--title', _L['Save Session'],
+ '--with-directory',
+ M.DEFAULT_SESSION:match('.+[/\\]') or '',
+ '--with-file',
+ M.DEFAULT_SESSION:match('[^/\\]+$') or '',
+ '--no-newline'):iconv(_CHARSET, 'UTF-8')
if filename == '' then return end
local session = {}
local buffer_line = "buffer: %d %d %d %s" -- anchor, cursor, line, filename
@@ -171,7 +171,7 @@ function M.save(filename)
session[#session + 1] = view_line:format(spaces, 2, _BUFFERS[c2.buffer])
end
end
- local splits = gui.get_split_table()
+ local splits = ui.get_split_table()
if splits[1] and splits[2] then
write_split(splits, 0, 0)
else
@@ -180,7 +180,7 @@ function M.save(filename)
-- Write out the current focused view.
session[#session + 1] = ("current_view: %d"):format(_VIEWS[view])
-- Write out other things.
- local maximized, size = tostring(gui.maximized), gui.size
+ local maximized, size = tostring(ui.maximized), ui.size
session[#session + 1] = ("size: %s %d %d"):format(maximized, size[1], size[2])
for i = 1, #io.recent_files do
if i > M.MAX_RECENT_FILES then break end
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index e25f7a81..aa2933f8 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -187,10 +187,10 @@ function M._select()
for i = 1, #list do
t[#t + 1], t[#t + 2], t[#t + 3] = list[i]:match('^(%Z+)%z(%Z+)%z(%Z+)$')
end
- local i = gui.filteredlist(_L['Select Snippet'],
- {_L['Trigger'], _L['Scope'], _L['Snippet Text']},
- t, true, '--output-column', '2',
- CURSES and {'--width', gui.size[1] - 2} or '')
+ local i = ui.filteredlist(_L['Select Snippet'],
+ {_L['Trigger'], _L['Scope'], _L['Snippet Text']},
+ t, true, '--output-column', '2',
+ CURSES and {'--width', ui.size[1] - 2} or '')
if i then M._insert(t[(i + 1) * 3]) end
end