aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/editing.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2010-06-11 00:24:35 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2010-06-11 00:24:35 -0400
commit7a4800f05f26067a1cef77e5431256aab4c3d675 (patch)
treec20a86c11384fd8adb88af3acdd7d7757ebd0555 /modules/textadept/editing.lua
parentc83387e378f72b303d692d951da841b581b3d453 (diff)
downloadtextadept-7a4800f05f26067a1cef77e5431256aab4c3d675.tar.gz
textadept-7a4800f05f26067a1cef77e5431256aab4c3d675.zip
Renamed textadept.events to events, renamed 'handle' and 'add_handler'.
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r--modules/textadept/editing.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index bb53b3ad..2d1586a2 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -2,6 +2,7 @@
local textadept = _G.textadept
local locale = _G.locale
+local events = _G.events
---
-- Editing commands for the textadept module.
@@ -73,14 +74,14 @@ local braces = { -- () [] {} <>
-- Used for displaying call tips.
local current_call_tip = {}
-textadept.events.add_handler('char_added',
+events.connect('char_added',
function(c) -- matches characters specified in char_matches
if AUTOPAIR and char_matches[c] and buffer.selections == 1 then
buffer:insert_text(-1, char_matches[c])
end
end)
-textadept.events.add_handler('keypress',
+events.connect('keypress',
function(code, shift, control, alt) -- removes matched chars on backspace
if AUTOPAIR and code == 0xff08 and buffer.selections == 1 then
local buffer = buffer
@@ -93,7 +94,7 @@ textadept.events.add_handler('keypress',
end
end)
-textadept.events.add_handler('update_ui',
+events.connect('update_ui',
function() -- highlights matching braces
local buffer = buffer
local current_pos = buffer.current_pos
@@ -110,7 +111,7 @@ textadept.events.add_handler('update_ui',
end
end)
-textadept.events.add_handler('char_added',
+events.connect('char_added',
function(char) -- auto-indent on return
if not AUTOINDENT or char ~= 10 then return end
local buffer = buffer
@@ -270,7 +271,7 @@ function prepare_for_save()
buffer:convert_eo_ls(buffer.eol_mode)
buffer:end_undo_action()
end
-textadept.events.add_handler('file_before_save', prepare_for_save)
+events.connect('file_before_save', prepare_for_save)
---
-- Cuts or copies text ranges intelligently. (Behaves like Emacs.)