aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/events.lua15
-rw-r--r--core/ext/command_entry.lua2
-rw-r--r--core/ext/find.lua4
-rw-r--r--core/ext/key_commands.lua9
-rw-r--r--core/ext/key_commands_mac.lua9
-rw-r--r--core/ext/key_commands_std.lua9
-rw-r--r--core/ext/keys.lua35
-rw-r--r--core/ext/menu.lua6
-rw-r--r--core/ext/mime_types.lua11
-rw-r--r--core/ext/pm/buffer_browser.lua13
-rw-r--r--core/ext/pm/ctags_browser.lua11
-rw-r--r--core/ext/pm/file_browser.lua2
-rw-r--r--core/ext/pm/find_browser.lua2
-rw-r--r--core/ext/pm/macro_browser.lua9
-rw-r--r--core/ext/pm/modules_browser.lua3
-rw-r--r--core/ext/pm/project_browser.lua2
-rw-r--r--core/file_io.lua11
-rw-r--r--core/init.lua2
-rw-r--r--init.lua3
-rw-r--r--modules/cpp/commands.lua2
-rw-r--r--modules/lua/commands.lua32
-rw-r--r--modules/textadept/bookmarks.lua4
-rw-r--r--modules/textadept/editing.lua5
-rw-r--r--modules/textadept/lsnippets.lua2
-rw-r--r--modules/textadept/macros.lua7
-rw-r--r--modules/textadept/snippets.lua2
-rw-r--r--themes/dark/buffer.lua3
-rw-r--r--themes/dark/view.lua4
-rw-r--r--themes/light/buffer.lua3
-rw-r--r--themes/light/view.lua4
-rw-r--r--themes/scite/buffer.lua41
-rw-r--r--themes/scite/view.lua4
32 files changed, 166 insertions, 105 deletions
diff --git a/core/events.lua b/core/events.lua
index afb119e0..fd9a958c 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Module that handles Scintilla and Textadept notifications/events.
-- Most of Textadept's functionality comes through handlers. Scintilla
@@ -204,7 +206,8 @@ end
add_handler('view_new',
function() -- sets default properties for a Scintilla window
- local c, buffer = textadept.constants, buffer
+ local buffer = buffer
+ local c = textadept.constants
-- properties
buffer.property['textadept.home'] = _HOME
@@ -293,7 +296,7 @@ add_handler('view_new',
add_handler('buffer_new',
function() -- sets default properties for a Scintilla document
local function run()
- local textadept, buffer = textadept, buffer
+ local buffer = buffer
-- lexer
buffer.style_bits = 8
@@ -370,7 +373,7 @@ local title_text = '%s %s Textadept (%s)'
-- filename.
-- @param buffer The currently focused buffer.
local function set_title(buffer)
- local buffer, textadept = buffer, textadept
+ local buffer = buffer
local filename = buffer.filename or textadept.locale.UNTITLED
local d = buffer.dirty and '*' or '-'
textadept.title =
@@ -481,7 +484,8 @@ local EOLs = {
}
add_handler('update_ui',
function() -- sets docstatusbar text
- local buffer, locale = buffer, textadept.locale
+ local buffer = buffer
+ local locale = textadept.locale
local pos = buffer.current_pos
local line, max = buffer:line_from_position(pos) + 1, buffer.line_count
local col = buffer.column[pos] + 1
@@ -503,7 +507,7 @@ add_handler('margin_click',
add_handler('buffer_new',
function() -- set additional buffer functions
- local buffer, textadept = buffer, textadept
+ local buffer = buffer
buffer.reload = textadept.io.reload
buffer.save = textadept.io.save
buffer.save_as = textadept.io.save_as
@@ -558,7 +562,6 @@ end
-- @param ... Error strings.
function error(...)
local function handle_error(...)
- local textadept = textadept
local error_message = table.concat({...} , '\n')
local error_buffer
for index, buffer in ipairs(textadept.buffers) do
diff --git a/core/ext/command_entry.lua b/core/ext/command_entry.lua
index f1bd1820..29e38bb6 100644
--- a/core/ext/command_entry.lua
+++ b/core/ext/command_entry.lua
@@ -1,5 +1,6 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
local ce = textadept.command_entry
---
@@ -8,7 +9,6 @@ local ce = textadept.command_entry
-- @param command The command to complete.
-- @return sorted table of completions
function ce.get_completions_for(command)
- local textadept = textadept
local substring = command:match('[%w_.:]+$') or ''
local path, o, prefix = substring:match('^([%w_.:]-)([.:]?)([%w_]*)$')
local ret, tbl = pcall(loadstring('return ('..path..')'))
diff --git a/core/ext/find.lua b/core/ext/find.lua
index 5def64e8..e036934f 100644
--- a/core/ext/find.lua
+++ b/core/ext/find.lua
@@ -1,5 +1,6 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
local find = textadept.find
---
@@ -25,7 +26,7 @@ local escapes = {
-- for displaying useful statusbar information. This flag is used and set
-- internally, and should not be set otherwise.
function find.find(text, next, flags, nowrap, wrapped)
- local buffer, textadept = buffer, textadept
+ local buffer = buffer
local increment, result
text = text:gsub('\\[abfnrtv\\]', escapes)
find.captures = nil
@@ -135,7 +136,6 @@ end
-- @param flags The number mask identical to the one in 'find'.
-- @see find.find
function find.replace_all(ftext, rtext, flags)
- local textadept = textadept
buffer:goto_pos(0)
local count = 0
while(find.find(ftext, true, flags, true)) do
diff --git a/core/ext/key_commands.lua b/core/ext/key_commands.lua
index 6e3f0145..25c7c239 100644
--- a/core/ext/key_commands.lua
+++ b/core/ext/key_commands.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Defines the key commands used by the Textadept key command manager.
-- For non-ascii keys, see textadept.keys for string aliases.
@@ -14,12 +16,7 @@ module('textadept.key_commands', package.seeall)
CSA: C D G H J K L O Q R S T U W X Z
]]--
----
--- Global container that holds all key commands.
--- @class table
--- @name keys
-_G.keys = {}
-local keys = keys
+local keys = _G.keys
keys.clear_sequence = 'esc'
diff --git a/core/ext/key_commands_mac.lua b/core/ext/key_commands_mac.lua
index 11378804..2e8e82b2 100644
--- a/core/ext/key_commands_mac.lua
+++ b/core/ext/key_commands_mac.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Defines the key commands used by the Textadept key command manager.
-- For non-ascii keys, see textadept.keys for string aliases.
@@ -15,12 +17,7 @@ module('textadept.key_commands_mac', package.seeall)
CSA: A C D E G H J K L M N O P Q R S T U V W X Y Z
]]--
----
--- Global container that holds all key commands.
--- @class table
--- @name keys
-_G.keys = {}
-local keys = keys
+local keys = _G.keys
keys.clear_sequence = 'aesc'
diff --git a/core/ext/key_commands_std.lua b/core/ext/key_commands_std.lua
index 499305f6..2d7688d8 100644
--- a/core/ext/key_commands_std.lua
+++ b/core/ext/key_commands_std.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Defines the key commands used by the Textadept key command manager.
-- For non-ascii keys, see textadept.keys for string aliases.
@@ -15,12 +17,7 @@ module('textadept.key_commands_std', package.seeall)
CSA: A B C D E F G H J K L M N O P Q R S T U V W X Y Z
]]--
----
--- Global container that holds all key commands.
--- @class table
--- @name keys
-_G.keys = {}
-local keys = keys
+local keys = _G.keys
keys.clear_sequence = 'esc'
diff --git a/core/ext/keys.lua b/core/ext/keys.lua
index 818479a9..466a74c2 100644
--- a/core/ext/keys.lua
+++ b/core/ext/keys.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Manages key commands in Textadept.
-- Default key commands should be defined in a separate file and loaded after
@@ -76,6 +78,23 @@ local ALT = 'a'..ADD
-- end options
---
+-- Global container that holds all key commands.
+-- @class table
+-- @name keys
+_G.keys = {}
+
+-- optimize for speed
+local keys = _G.keys
+local string = _G.string
+local string_char = string.char
+local string_format = string.format
+local pcall = _G.pcall
+local ipairs = _G.ipairs
+local next = _G.next
+local type = _G.type
+local unpack = _G.unpack
+
+---
-- [Local table] Lookup table for key values higher than 255.
-- If a key value given to 'keypress' is higher than 255, this table is used to
-- return a string representation of the key if it exists.
@@ -124,15 +143,13 @@ end
-- @return whatever the executed command returns, true by default. A true
-- return value will tell Textadept not to handle the key afterwords.
local function keypress(code, shift, control, alt)
- local buffer, textadept = buffer, textadept
- local string, pcall = string, pcall
- local keys = _G.keys
+ local buffer = buffer
local key
--print(code, string.char(code))
if code < 256 then
- key = string.char(code):lower()
+ key = string_char(code):lower()
if MAC and not shift and not control and not alt then
- local ch = string.char(code)
+ local ch = string_char(code)
-- work around native GTK-OSX's handling of Alt key
if ch:match('[^A-Za-z ]') and #keychain == 0 then
buffer:add_text(ch)
@@ -147,7 +164,7 @@ local function keypress(code, shift, control, alt)
control = control and CTRL or ''
shift = shift and SHIFT or ''
alt = alt and ALT or ''
- local key_seq = string.format('%s%s%s%s', control, shift, alt, key)
+ local key_seq = string_format('%s%s%s%s', control, shift, alt, key)
if #keychain > 0 and key_seq == keys.clear_sequence then
clear_key_sequence()
@@ -224,10 +241,10 @@ end
-- of -1. This way, pcall will return false and -1, where the -1 can easily and
-- efficiently be checked rather than using a string error message.
try_get_cmd = function(active_table)
- local locale = textadept.locale
for _, key_seq in ipairs(keychain) do active_table = active_table[key_seq] end
if #active_table == 0 and next(active_table) then
- textadept.statusbar_text = locale.KEYCHAIN..table.concat(keychain, ' ')
+ textadept.statusbar_text =
+ textadept.locale.KEYCHAIN..table.concat(keychain, ' ')
error(-1, 0)
else
local func = active_table[1]
@@ -241,7 +258,7 @@ try_get_cmd = function(active_table)
return view[func], { view, unpack(active_table, 3) }
end
else
- error(locale.KEYS_UNKNOWN_COMMAND..tostring(func))
+ error(textadept.locale.KEYS_UNKNOWN_COMMAND..tostring(func))
end
end
end
diff --git a/core/ext/menu.lua b/core/ext/menu.lua
index e7f57d5a..3398f47e 100644
--- a/core/ext/menu.lua
+++ b/core/ext/menu.lua
@@ -1,11 +1,15 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Provides dynamic menus for Textadept.
-- This module, like ext/key_commands, should be 'require'ed last.
module('textadept.menu', package.seeall)
-local t, gtkmenu, l = textadept, textadept.gtkmenu, textadept.locale
+local t = textadept
+local l = textadept.locale
+local gtkmenu = textadept.gtkmenu
local SEPARATOR = 'separator'
local ID = {
diff --git a/core/ext/mime_types.lua b/core/ext/mime_types.lua
index 6d4ec37a..8ee41c7c 100644
--- a/core/ext/mime_types.lua
+++ b/core/ext/mime_types.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
--- Handles file-specific settings (based on file extension).
module('textadept.mime_types', package.seeall)
@@ -334,8 +336,7 @@ local function handle_switch()
end
end
-local events = textadept.events
-events.add_handler('file_opened', handle_new)
-events.add_handler('file_saved_as', handle_new)
-events.add_handler('buffer_switch', handle_switch)
-events.add_handler('view_new', handle_switch)
+textadept.events.add_handler('file_opened', handle_new)
+textadept.events.add_handler('file_saved_as', handle_new)
+textadept.events.add_handler('buffer_switch', handle_switch)
+textadept.events.add_handler('view_new', handle_switch)
diff --git a/core/ext/pm/buffer_browser.lua b/core/ext/pm/buffer_browser.lua
index 73b09d55..83bb26f9 100644
--- a/core/ext/pm/buffer_browser.lua
+++ b/core/ext/pm/buffer_browser.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Buffer browser for the Textadept project manager.
-- It is enabled with the prefix 'buffers' in the project manager entry field.
@@ -62,12 +64,11 @@ function perform_menu_action(menu_item, menu_id, selected_item)
textadept.pm.activate()
end
-local add_handler = textadept.events.add_handler
local function update_view()
if matches(textadept.pm.entry_text) then textadept.pm.activate() end
end
-add_handler('file_opened', update_view)
-add_handler('buffer_new', update_view)
-add_handler('buffer_deleted', update_view)
-add_handler('save_point_reached', update_view)
-add_handler('save_point_left', update_view)
+textadept.events.add_handler('file_opened', update_view)
+textadept.events.add_handler('buffer_new', update_view)
+textadept.events.add_handler('buffer_deleted', update_view)
+textadept.events.add_handler('save_point_reached', update_view)
+textadept.events.add_handler('save_point_left', update_view)
diff --git a/core/ext/pm/ctags_browser.lua b/core/ext/pm/ctags_browser.lua
index e1b4586d..8f112470 100644
--- a/core/ext/pm/ctags_browser.lua
+++ b/core/ext/pm/ctags_browser.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- CTags Browser for the Textadept project manager.
-- It is enabled with the prefix 'ctags' in the project manager entry field
@@ -234,7 +236,6 @@ function perform_menu_action(menu_item, menu_id, selected_item)
end
-local add_handler = textadept.events.add_handler
local function update_view()
if matches(textadept.pm.entry_text) then
if buffer.filename then
@@ -244,7 +245,7 @@ local function update_view()
end
end
end
-add_handler('file_opened', update_view)
-add_handler('buffer_deleted', update_view)
-add_handler('buffer_switch', update_view)
-add_handler('save_point_reached', update_view)
+textadept.events.add_handler('file_opened', update_view)
+textadept.events.add_handler('buffer_deleted', update_view)
+textadept.events.add_handler('buffer_switch', update_view)
+textadept.events.add_handler('save_point_reached', update_view)
diff --git a/core/ext/pm/file_browser.lua b/core/ext/pm/file_browser.lua
index c658b6c0..87d4b8e6 100644
--- a/core/ext/pm/file_browser.lua
+++ b/core/ext/pm/file_browser.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- File browser for the Textadept project manager.
-- It is enabled by providing the absolute path to a directory in the project
diff --git a/core/ext/pm/find_browser.lua b/core/ext/pm/find_browser.lua
index a8722e78..c79ab167 100644
--- a/core/ext/pm/find_browser.lua
+++ b/core/ext/pm/find_browser.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Find in files browser for the Textadept project manager.
-- It is enabled with the prefix 'find' in the project manager entry field.
diff --git a/core/ext/pm/macro_browser.lua b/core/ext/pm/macro_browser.lua
index c2892fa7..051487cf 100644
--- a/core/ext/pm/macro_browser.lua
+++ b/core/ext/pm/macro_browser.lua
@@ -1,12 +1,12 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Macro browser for the Textadept project manager.
-- It is enabled with the prefix 'macros' in the project manager entry field.
module('textadept.pm.browsers.macro', package.seeall)
-local textadept = textadept
-
function matches(entry_text)
return entry_text:sub(1, 7) == 'macros'
end
@@ -38,9 +38,8 @@ function perform_menu_action(menu_item, menu_id, selected_item)
textadept.pm.activate()
end
-local add_handler = textadept.events.add_handler
local function update_view()
if matches(textadept.pm.entry_text) then textadept.pm.activate() end
end
-add_handler('macro_saved', update_view)
-add_handler('macro_deleted', update_view)
+textadept.events.add_handler('macro_saved', update_view)
+textadept.events.add_handler('macro_deleted', update_view)
diff --git a/core/ext/pm/modules_browser.lua b/core/ext/pm/modules_browser.lua
index 4fc97206..757e7d93 100644
--- a/core/ext/pm/modules_browser.lua
+++ b/core/ext/pm/modules_browser.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Modules browser for the Textadept project manager.
-- It is enabled with the prefix 'modules' in the project manager entry field.
@@ -182,7 +184,6 @@ function perform_menu_action(menu_item, menu_id, selected_item)
elseif menu_id == ID.CONF_MIME_TYPES then
textadept.io.open(_HOME..'/core/ext/mime_types.lua')
elseif menu_id == ID.CONF_KEY_COMMANDS then
- local textadept = textadept
if textadept.key_commands then
textadept.io.open(_HOME..'/core/ext/key_commands.lua')
elseif textadept.key_commands_std then
diff --git a/core/ext/pm/project_browser.lua b/core/ext/pm/project_browser.lua
index 30c6a847..0219839e 100644
--- a/core/ext/pm/project_browser.lua
+++ b/core/ext/pm/project_browser.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Browser template for the Textadept project manager.
-- It is enabled with the prefix 'project' in the project manager entry field.
diff --git a/core/file_io.lua b/core/file_io.lua
index 943bc6f0..5e76e886 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Provides file input/output routines for Textadept.
-- Opens and saves files and sessions and reads API files.
@@ -9,8 +11,6 @@
-- file_saved_as(filename)
module('textadept.io', package.seeall)
-local events = textadept.events
-
---
-- List of recently opened files.
-- @class table
@@ -34,7 +34,7 @@ local function open_helper(filename)
end
buffer.filename = filename
buffer:set_save_point()
- events.handle('file_opened', filename)
+ textadept.events.handle('file_opened', filename)
recent_files[#recent_files + 1] = filename
end
@@ -92,7 +92,7 @@ function save(buffer)
f:close()
buffer:set_save_point()
else
- events.error(err)
+ textadept.events.error(err)
end
end
@@ -115,7 +115,7 @@ function save_as(buffer, filename)
if #filename > 0 then
buffer.filename = filename
buffer:save()
- events.handle('file_saved_as', filename)
+ textadept.events.handle('file_saved_as', filename)
end
end
@@ -179,7 +179,6 @@ end
-- @return true if the session file was opened and read; false otherwise.
-- @usage textadept.io.load_session(filename)
function load_session(filename, only_pm)
- local textadept = textadept
local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE')
if not user_dir then return end
local ta_session = user_dir..'/.ta_session'
diff --git a/core/init.lua b/core/init.lua
index 8a7b96de..38ed7734 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
package.path = _HOME..'/core/?.lua;'..package.path
if not WIN32 then
package.cpath = _HOME..'/core/?.so;'..package.cpath
diff --git a/init.lua b/init.lua
index 90e067e6..87782215 100644
--- a/init.lua
+++ b/init.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
local mpath = _HOME..'/modules/?.lua;'.._HOME..'/modules/?/init.lua'
package.path = mpath..';'..package.path
@@ -32,7 +34,6 @@ require 'ext/key_commands' -- key commands for Mitchell (Nano-Emacs hybrid)
if not RESETTING then
-- process command line arguments
- local textadept = textadept
if MAC and arg[1] and arg[1]:match('^%-psn_0') then
table.remove(arg, 1)
end
diff --git a/modules/cpp/commands.lua b/modules/cpp/commands.lua
index 09ea1dfe..d1e2fd17 100644
--- a/modules/cpp/commands.lua
+++ b/modules/cpp/commands.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Commands for the cpp module.
module('_m.cpp.commands', package.seeall)
diff --git a/modules/lua/commands.lua b/modules/lua/commands.lua
index 654c6cfb..5e5fbc93 100644
--- a/modules/lua/commands.lua
+++ b/modules/lua/commands.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Commands for the lua module.
module('_m.lua.commands', package.seeall)
@@ -21,16 +23,18 @@ local control_structure_patterns = {
function try_to_autocomplete_end()
local buffer = buffer
buffer:begin_undo_action()
- buffer:line_end() buffer:new_line()
+ buffer:line_end()
+ buffer:new_line()
local line_num = buffer:line_from_position(buffer.current_pos)
local line = buffer:get_line(line_num - 1)
for _, patt in ipairs(control_structure_patterns) do
if line:match(patt) then
local indent = buffer.line_indentation[line_num - 1]
- buffer:add_text( patt:match('repeat') and '\nuntil' or '\nend' )
+ buffer:add_text(patt:match('repeat') and '\nuntil' or '\nend')
buffer.line_indentation[line_num + 1] = indent
buffer.line_indentation[line_num] = indent + buffer.indent
- buffer:line_up() buffer:line_end()
+ buffer:line_up()
+ buffer:line_end()
break
end
end
@@ -54,7 +58,11 @@ function goto_required()
for path in package.path:gmatch('[^;]+') do
path = path:gsub('?', file)
local f = io.open(path)
- if f then f:close() textadept.io.open(path) break end
+ if f then
+ f:close()
+ textadept.io.open(path)
+ break
+ end
end
end
@@ -80,12 +88,14 @@ if type(keys) == 'table' then
},
['s\n'] = { try_to_autocomplete_end },
cg = { run },
- ['('] = { function()
- buffer.word_chars =
- '_.:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
- m_editing.show_call_tip(_m.lua.api, true)
- buffer:set_chars_default()
- return false
- end },
+ ['('] = {
+ function()
+ buffer.word_chars =
+ '_.:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ m_editing.show_call_tip(_m.lua.api, true)
+ buffer:set_chars_default()
+ return false
+ end
+ },
}
end
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua
index 8bcd3e7d..80853c29 100644
--- a/modules/textadept/bookmarks.lua
+++ b/modules/textadept/bookmarks.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Bookmarks for the textadept module.
-- There are several option variables used:
@@ -48,6 +50,7 @@ end
---
-- Goes to the next bookmark in the current buffer.
function goto_next()
+ local buffer = buffer
local current_line = buffer:line_from_position(buffer.current_pos)
local line = buffer:marker_next(current_line + 1, 1)
if line >= 0 then _m.textadept.editing.goto_line(line + 1) end
@@ -56,6 +59,7 @@ end
---
-- Goes to the previous bookmark in the current buffer.
function goto_prev()
+ local buffer = buffer
local current_line = buffer:line_from_position(buffer.current_pos)
local line = buffer:marker_previous(current_line - 1, 1)
if line >= 0 then _m.textadept.editing.goto_line(line + 1) end
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 47166cf5..069135b2 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Editing commands for the textadept module.
module('_m.textadept.editing', package.seeall)
@@ -232,7 +234,8 @@ end
-- Goes to the requested line.
-- @param line Optional line number to go to.
function goto_line(line)
- local buffer, locale = buffer, textadept.locale
+ local buffer = buffer
+ local locale = textadept.locale
if not line then
line =
cocoa_dialog('standard-inputbox', {
diff --git a/modules/textadept/lsnippets.lua b/modules/textadept/lsnippets.lua
index 47819ae5..ee7a394b 100644
--- a/modules/textadept/lsnippets.lua
+++ b/modules/textadept/lsnippets.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Provides Lua-centric snippets for Textadept.
-- Snippets are basically pieces of text inserted into a document, but can
diff --git a/modules/textadept/macros.lua b/modules/textadept/macros.lua
index 978a3482..62f9f972 100644
--- a/modules/textadept/macros.lua
+++ b/modules/textadept/macros.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Support for recording, saving, and playing macros for the textadept module.
--
@@ -63,7 +65,7 @@ function stop_recording()
if not recording then return end
buffer:stop_record()
recording = false
- local textadept, locale = textadept, textadept.locale
+ local locale = textadept.locale
local ret, macro_name =
cocoa_dialog('standard-inputbox', {
['informative-text'] = locale.M_TEXTADEPT_MACRO_SAVE_TITLE,
@@ -117,7 +119,8 @@ function play(macro_name)
end
local macro = list[macro_name]
if not macro then return end
- local buffer, bf = buffer, textadept.buffer_functions
+ local buffer = buffer
+ local bf = textadept.buffer_functions
for _, command in ipairs(macro) do
local cmd, wParam, lParam = unpack(command)
local _, _, p1_type, p2_type = unpack(bf[cmd])
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index ec8cd11a..8d46610e 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -1,5 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local textadept = _G.textadept
+
---
-- Provides Textmate-like snippets for the textadept module.
-- There are several option variables used:
diff --git a/themes/dark/buffer.lua b/themes/dark/buffer.lua
index bf9862fe..db045766 100644
--- a/themes/dark/buffer.lua
+++ b/themes/dark/buffer.lua
@@ -1,7 +1,8 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-- Dark editor theme for Textadept.
-local textadept, buffer = textadept, buffer
+local textadept = _G.textadept
+local buffer = buffer
-- folding
buffer.property['fold'] = '1'
diff --git a/themes/dark/view.lua b/themes/dark/view.lua
index 0a576637..63fd79d0 100644
--- a/themes/dark/view.lua
+++ b/themes/dark/view.lua
@@ -1,7 +1,9 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-- Dark editor theme for Textadept.
-local c, buffer = textadept.constants, buffer
+local textadept = _G.textadept
+local c = textadept.constants
+local buffer = buffer
-- caret
buffer.caret_fore = 11184810 -- 0xAA | 0xAA << 8 | 0xAA << 16
diff --git a/themes/light/buffer.lua b/themes/light/buffer.lua
index 9d62eb38..f31d8d3d 100644
--- a/themes/light/buffer.lua
+++ b/themes/light/buffer.lua
@@ -1,7 +1,8 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-- Light editor theme for Textadept.
-local textadept, buffer = textadept, buffer
+local textadept = _G.textadept
+local buffer = buffer
-- folding
buffer.property['fold'] = '1'
diff --git a/themes/light/view.lua b/themes/light/view.lua
index 3065fc67..99ce21e6 100644
--- a/themes/light/view.lua
+++ b/themes/light/view.lua
@@ -1,7 +1,9 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-- Light editor theme for Textadept.
-local c, buffer = textadept.constants, buffer
+local textadept = _G.textadept
+local c = textadept.constants
+local buffer = buffer
-- caret
buffer.caret_fore = 3355443 -- 0x33 | 0x33 << 8 | 0x33 << 16
diff --git a/themes/scite/buffer.lua b/themes/scite/buffer.lua
index 0b70c606..aa5555f5 100644
--- a/themes/scite/buffer.lua
+++ b/themes/scite/buffer.lua
@@ -1,20 +1,21 @@
--- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
--- SciTE editor theme for Textadept.
-
-local textadept, buffer = textadept, buffer
-
--- folding
-buffer.property['fold'] = '1'
-buffer.property['fold.by.indentation'] = '1'
-
--- tabs and indentation
-buffer.tab_width = 2
-buffer.use_tabs = false
-buffer.indent = 2
-buffer.tab_indents = true
-buffer.back_space_un_indents = true
-buffer.indentation_guides = 1
-
--- various
-buffer.eol_mode = textadept.constants.SC_EOL_LF
-buffer.auto_c_choose_single = true
+-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+-- SciTE editor theme for Textadept.
+
+local textadept = _G.textadept
+local buffer = buffer
+
+-- folding
+buffer.property['fold'] = '1'
+buffer.property['fold.by.indentation'] = '1'
+
+-- tabs and indentation
+buffer.tab_width = 2
+buffer.use_tabs = false
+buffer.indent = 2
+buffer.tab_indents = true
+buffer.back_space_un_indents = true
+buffer.indentation_guides = 1
+
+-- various
+buffer.eol_mode = textadept.constants.SC_EOL_LF
+buffer.auto_c_choose_single = true
diff --git a/themes/scite/view.lua b/themes/scite/view.lua
index ff068f39..86e1c95f 100644
--- a/themes/scite/view.lua
+++ b/themes/scite/view.lua
@@ -1,7 +1,9 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-- SciTE editor theme for Textadept.
-local buffer, c = buffer, textadept.constants
+local textadept = _G.textadept
+local c = textadept.constants
+local buffer = buffer
buffer.margin_width_n[0] = 4 * buffer:text_width(c.STYLE_LINENUMBER, "9")