From 30f5250828d0dffe9bf14cf48db530ddf6ca3c9d Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 20 Aug 2020 22:54:55 -0400 Subject: Do not accidentally activate "auto enclose" with some symbol keybindings. --- modules/textadept/editing.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'modules') 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) --- -- cgit v1.2.3