aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2010-03-24 00:55:28 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2010-03-24 00:55:28 -0400
commitdd5f4cc5b039b7829fcd2485edf9008c5b8c206b (patch)
tree4ad24cd3f4d78c124180d619b91b2b5b0bf9dd6d /modules/textadept
parent583e8eccb5eee9d0b96dbf1af36df0022e6a3468 (diff)
downloadtextadept-dd5f4cc5b039b7829fcd2485edf9008c5b8c206b.tar.gz
textadept-dd5f4cc5b039b7829fcd2485edf9008c5b8c206b.zip
Make options configurable from user init.lua; modules/textadept/editing.lua
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/editing.lua12
1 files changed, 3 insertions, 9 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 1813a4a6..0c001076 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -72,21 +72,18 @@ local comment_strings = {
ruby = '#~',
}
-if AUTOPAIR then
textadept.events.add_handler('char_added',
function(c) -- matches characters specified in char_matches
- if char_matches[c] and buffer.selections == 1 then
+ if AUTOPAIR and char_matches[c] and buffer.selections == 1 then
buffer:insert_text(-1, char_matches[c])
end
end)
-end
-if HIGHLIGHT_BRACES then
textadept.events.add_handler('update_ui',
function() -- highlights matching braces
local buffer = buffer
local current_pos = buffer.current_pos
- if braces[buffer.char_at[current_pos]] and
+ if HIGHLIGHT_BRACES and braces[buffer.char_at[current_pos]] and
buffer:get_style_name(buffer.style_at[current_pos]) == 'operator' then
local pos = buffer:brace_match(current_pos)
if pos ~= -1 then
@@ -98,12 +95,10 @@ textadept.events.add_handler('update_ui',
buffer:brace_bad_light(-1)
end
end)
-end
-if AUTOINDENT then
textadept.events.add_handler('char_added',
function(char) -- auto-indent on return
- if char ~= 10 then return end
+ if not AUTOINDENT or char ~= 10 then return end
local buffer = buffer
local anchor, caret = buffer.anchor, buffer.current_pos
local curr_line = buffer:line_from_position(caret)
@@ -127,7 +122,6 @@ textadept.events.add_handler('char_added',
buffer:set_sel(anchor, caret)
end
end)
-end
-- local functions
local insert_into_kill_ring, scroll_kill_ring