aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/command_entry.lua3
-rw-r--r--modules/textadept/editing.lua40
-rw-r--r--modules/textadept/run.lua6
3 files changed, 28 insertions, 21 deletions
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index db26b8f2..8033b48c 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -10,6 +10,8 @@ local M = ui.command_entry
-- running Lua code and filtering text through shell commands) and history.
-- @field height (number)
-- The height in pixels of the command entry.
+-- @field active (boolean)
+-- Whether or not the command entry is active.
module('ui.command_entry')]]
-- Command history per mode.
@@ -237,6 +239,7 @@ end
local orig_focus = M.focus
M.focus = function()
keys.mode = prev_key_mode
+ M.active = not M.active
orig_focus()
end
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 39e54dac..1830e047 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -148,17 +148,19 @@ end)
-- Removes matched chars on backspace, taking multiple selections into account.
events.connect(events.KEYPRESS, function(code)
- if not M.auto_pairs or keys.KEYSYMS[code] ~= '\b' then return end
- buffer:begin_undo_action()
- for i = 1, buffer.selections do
- local pos = buffer.selection_n_caret[i]
- local complement = M.auto_pairs[buffer.char_at[pos - 1]]
- if complement and buffer.char_at[pos] == string.byte(complement) then
- buffer:set_target_range(pos, pos + 1)
- buffer:replace_target('')
+ if M.auto_pairs and keys.KEYSYMS[code] == '\b' and
+ not ui.command_entry.active then
+ buffer:begin_undo_action()
+ for i = 1, buffer.selections do
+ local pos = buffer.selection_n_caret[i]
+ local complement = M.auto_pairs[buffer.char_at[pos - 1]]
+ if complement and buffer.char_at[pos] == string.byte(complement) then
+ buffer:set_target_range(pos, pos + 1)
+ buffer:replace_target('')
+ end
end
+ buffer:end_undo_action()
end
- buffer:end_undo_action()
end, 1) -- need index of 1 because default key handler halts propagation
-- Highlights matching braces.
@@ -214,16 +216,18 @@ end)
-- Moves over typeover characters when typed, taking multiple selections into
-- account.
events.connect(events.KEYPRESS, function(code)
- if not M.typeover_chars or not M.typeover_chars[code] then return end
- local handled = false
- for i = 1, buffer.selections do
- local s, e = buffer.selection_n_start[i], buffer.selection_n_end[i]
- if s == e and buffer.char_at[s] == code then
- buffer.selection_n_start[i], buffer.selection_n_end[i] = s + 1, s + 1
- handled = true
+ if M.typeover_chars and M.typeover_chars[code] and
+ not ui.command_entry.active then
+ local handled = false
+ for i = 1, buffer.selections do
+ local s, e = buffer.selection_n_start[i], buffer.selection_n_end[i]
+ if s == e and buffer.char_at[s] == code then
+ buffer.selection_n_start[i], buffer.selection_n_end[i] = s + 1, s + 1
+ handled = true
+ end
end
+ if handled then return true end -- prevent typing
end
- if handled then return true end -- prevent typing
end)
-- Auto-indent on return.
@@ -474,7 +478,7 @@ end
-- Enclose selected text in punctuation or auto-paired characters.
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
+ not ctrl and not alt and not cmd and not ui.command_entry.active then
local char = string.char(code)
if char:find('^%P') then return end -- not punctuation
M.enclose(char, M.auto_pairs[code] or char)
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index d76ae030..ffccc7e7 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -90,11 +90,11 @@ local function scan_for_error(message, ext_or_lexer)
end
detail.warning =
message:lower():find('warning') and not message:lower():find('error')
- -- Compile and run commands specify the file extension or lexer name used
- -- to determine the command, so the error patterns used are guaranteed to
+ -- Compile and run commands specify the file extension or lexer name used
+ -- to determine the command, so the error patterns used are guaranteed to
-- be correct. Build commands have no such context and instead iterate
-- through all possible error patterns. Only consider the error/warning
- -- valid if the extracted filename's extension or lexer name matches the
+ -- valid if the extracted filename's extension or lexer name matches the
-- error pattern's extension or lexer name.
if ext_or_lexer then return detail end
local ext = detail.filename:match('[^/\\.]+$')