aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/events.lua2
-rw-r--r--core/ext/keys.lua2
-rw-r--r--modules/textadept/editing.lua7
3 files changed, 5 insertions, 6 deletions
diff --git a/core/events.lua b/core/events.lua
index 989877c0..3d0cadee 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -110,7 +110,7 @@ end
-- Scintilla notifications.
function char_added(n)
- if n.ch < 256 then return handle('char_added', string.char(n.ch)) end
+ return handle('char_added', n.ch)
end
function save_point_reached()
return handle('save_point_reached')
diff --git a/core/ext/keys.lua b/core/ext/keys.lua
index dd314375..275fa641 100644
--- a/core/ext/keys.lua
+++ b/core/ext/keys.lua
@@ -157,7 +157,7 @@ local function keypress(code, shift, control, alt)
if ch:find('[%p%d]') and #keychain == 0 then
if buffer.anchor ~= buffer.current_pos then buffer:delete_back() end
buffer:add_text(ch)
- textadept.events.handle('char_added', ch)
+ textadept.events.handle('char_added', code)
return true
end
end
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index c832c8fe..ee312df0 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -20,8 +20,8 @@ local kill_ring = { pos = 1, maxn = 10 }
-- @class table
-- @name char_matches
local char_matches = {
- ['('] = ')', ['['] = ']', ['{'] = '}',
- ["'"] = "'", ['"'] = '"'
+ [40] = ')', [91] = ']', [123] = '}',
+ [39] = "'", [34] = '"'
}
---
@@ -95,7 +95,7 @@ textadept.events.add_handler('update_ui',
textadept.events.add_handler('char_added',
function(char) -- auto-indent on return
- if char ~= '\n' then return end
+ if char ~= 10 then return end
local buffer = buffer
local anchor, caret = buffer.anchor, buffer.current_pos
local curr_line = buffer:line_from_position(caret)
@@ -483,7 +483,6 @@ end
-- Selects text in a specified enclosure.
-- @param str The enclosure type in enclosure.
-- @see enclosure
--- @see char_matches
function select_enclosed(str)
if not str then return end
local buffer = buffer