diff options
author | 2020-08-20 22:54:55 -0400 | |
---|---|---|
committer | 2020-08-20 22:54:55 -0400 | |
commit | 30f5250828d0dffe9bf14cf48db530ddf6ca3c9d (patch) | |
tree | 5b1a1d02368ea2ba57c8b38009278493e5e9efc1 /modules | |
parent | 5c955e5199c87e1508c8efab74d10367a058bc0c (diff) | |
download | textadept-30f5250828d0dffe9bf14cf48db530ddf6ca3c9d.tar.gz textadept-30f5250828d0dffe9bf14cf48db530ddf6ca3c9d.zip |
Do not accidentally activate "auto enclose" with some symbol keybindings.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/textadept/editing.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index 3e0ad869..39e54dac 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -472,12 +472,14 @@ function M.enclose(left, right) end -- Enclose selected text in punctuation or auto-paired characters. -events.connect(events.KEYPRESS, function(code) - if not M.auto_enclose or buffer.selection_empty or code >= 256 then return end - local char = string.char(code) - if char:find('^%P') then return end -- not punctuation - M.enclose(char, M.auto_pairs[code] or char) - return true -- prevent typing +events.connect(events.KEYPRESS, function(code, shift, ctrl, alt, cmd) + if M.auto_enclose and not buffer.selection_empty and code < 256 and + not ctrl and not alt and not cmd then + local char = string.char(code) + if char:find('^%P') then return end -- not punctuation + M.enclose(char, M.auto_pairs[code] or char) + return true -- prevent typing + end end, 1) --- |