aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-01-30 10:22:15 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2009-01-30 10:22:15 -0500
commitbd1ec707e74fdb26c97daec47dd9f0ed33a815c7 (patch)
tree70ecb86150904a475dd6d4ed2417998bc418c81f /modules
parent79ebec80245ef9e67c99bff09d224935c5cb9cea (diff)
downloadtextadept-bd1ec707e74fdb26c97daec47dd9f0ed33a815c7.tar.gz
textadept-bd1ec707e74fdb26c97daec47dd9f0ed33a815c7.zip
Moved highlight-braces from core/events.lua to modules/textadept/editing.lua.
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/editing.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index caf6daa0..e7cc684b 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -75,6 +75,23 @@ textadept.events.add_handler('char_added',
if char_matches[c] then buffer:insert_text(-1, char_matches[c]) end
end)
+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
+ buffer:get_style_name(buffer.style_at[current_pos]) == 'operator' then
+ local pos = buffer:brace_match(current_pos)
+ if pos ~= -1 then
+ buffer:brace_highlight(current_pos, pos)
+ else
+ buffer:brace_bad_light(current_pos)
+ end
+ else
+ buffer:brace_bad_light(-1)
+ end
+ end)
+
textadept.events.add_handler('char_added',
function(char) -- auto-indent on return
if char ~= '\n' then return end