aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/keys.lua9
-rw-r--r--modules/textadept/snippets.lua5
2 files changed, 8 insertions, 6 deletions
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index 4d8e9ad5..3992dba6 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -89,7 +89,7 @@ local M = {}
-- Tab |⇥ |Tab |Expand snippet or next placeholder
-- Ctrl+K |⌥⇥ |M-K |Insert snippet...
-- Shift+Tab |⇧⇥ |S-Tab |Previous snippet placeholder
--- Ctrl+Shift+K |⌥⇧⇥ |M-S-K |Cancel snippet
+-- Esc |Esc |Esc |Cancel snippet
-- Ctrl+F2 |⌘F2 |F1 |Toggle bookmark
-- Ctrl+Shift+F2 |⌘⇧F2 |F6 |Clear bookmarks
-- F2 |F2 |F2 |Next bookmark
@@ -220,7 +220,7 @@ module('textadept.keys')]]
-- Windows and Linux key bindings.
--
-- Unassigned keys (~ denotes keys reserved by the operating system):
--- c: C H I p Q T ~ V Y _ ) ] } +
+-- c: C H I K p Q T ~ V Y _ ) ] } +
-- a: aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ_ ) ] } *+-/=\n\s
-- ca: aAbBcCdD F jJkKlLmM N qQ t xXy zZ_"'()[]{}<>* / \s
--
@@ -263,7 +263,7 @@ module('textadept.keys')]]
-- Unassigned keys (~ denotes keys reserved by the operating system):
-- c: g~~ ~ ~
-- cm: cd g~~ k ~ q t yz
--- m: e J qQ sS vVw yY _ +
+-- m: e J K qQ sS vVw yY _ +
-- Note: m[befhstv] may be used by Linux/BSD GUI terminals for menu access.
--
-- CTRL = 'c' (Control ^)
@@ -413,8 +413,7 @@ keys[not OSX and (GUI and 'caP' or 'cmp') or 'cmP'] = io.quick_open
keys[not OSX and (GUI and 'ck' or 'mk') or 'a\t'] = textadept.snippets._select
keys['\t'] = textadept.snippets._insert
keys['s\t'] = textadept.snippets._previous
-keys[not OSX and (GUI and 'cK' or 'mK')
- or 'as\t'] = textadept.snippets._cancel_current
+keys.esc = textadept.snippets._cancel_current
-- Other.
keys[not OSX and ((GUI or WIN32) and 'c ' or 'c@')
or 'aesc'] = m_tools[_L['_Complete Symbol']][2]
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index cac83b7b..9788e36f 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -366,9 +366,12 @@ end
---
-- Cancels the active snippet, removing all inserted text.
+-- Returns `false` if no snippet is active.
+-- @return `false` if no snippet is active; `nil` otherwise.
-- @name _cancel_current
function M._cancel_current()
- if #snippet_stack > 0 then snippet_stack[#snippet_stack]:finish(true) end
+ if #snippet_stack == 0 then return false end
+ snippet_stack[#snippet_stack]:finish(true)
end
---