aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2016-04-11 20:32:52 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2016-04-11 20:32:52 -0400
commitc51691cc71fa787df36ae6b2e37611e6e55ec17f (patch)
tree4323622fda65df25fef5bc1e93aebcbadf95457a /modules
parent1286b6b9d3bc6316e7ac75524966d946e8cdfd1b (diff)
downloadtextadept-c51691cc71fa787df36ae6b2e37611e6e55ec17f.tar.gz
textadept-c51691cc71fa787df36ae6b2e37611e6e55ec17f.zip
Fixed regression for `%<...>` and `%[...]`; modules/textadept/snippets.lua
It is currently not possible to escape `<` and `[` immediately after a `%n` mirror.
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/snippets.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index 972669ec..d1019dfb 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -82,11 +82,13 @@ local M = {}
-- Stands for a single '%' since '%' by itself has a special meaning in
-- snippets.
--
--- ### `%(`<br/>`%{`<br/>`%<`<br/>`%[`
+-- ### `%(`<br/>`%{`
--
--- Stands for a single '(', '{', '<', or '[', respectively, after a `%`*n*
--- mirror. Otherwise, the mirror would be interpreted as a placeholder or
--- transform.
+-- Stands for a single '(' or '{', respectively, after a `%`*n* mirror.
+-- Otherwise, the mirror would be interpreted as a placeholder or transform.
+-- Note: it is currently not possible to escape a '<' or '[' immediately after
+-- a `%`*n* mirror due to `%<...>` and `%[...]` sequences being interpreted as
+-- code to execute.
--
-- ### `\t`
--
@@ -182,7 +184,7 @@ local function new_snippet(text, trigger)
local C, Cp, Ct, Cg, Cc = lpeg.C, lpeg.Cp, lpeg.Ct, lpeg.Cg, lpeg.Cc
local patt = P{
V('plain_text') * V('placeholder') * Cp() + V('plain_text') * -1,
- plain_text = C(((P(1) - '%' + '%' * S('([{<'))^1 + '%%')^0),
+ plain_text = C(((P(1) - '%' + '%' * S('({'))^1 + '%%')^0),
placeholder = Ct('%' * (V('index')^-1 * (V('angles') + V('brackets') +
V('braces')) *
V('transform') +
@@ -358,7 +360,7 @@ function M._select()
items[#items + 1], items[#items + 2] = list[i]:match('^([^|]+)|(.+)$')
end
local button, i = ui.dialogs.filteredlist{
- title = _L['Select Snippet'], columns = {_L['Trigger'], _L['Snippet Text']},
+ title = _L['Select Snippet'], columns = {_L['Trigger'], _L['Snippet Text']},
items = items, width = CURSES and ui.size[1] - 2 or nil
}
if button == 1 and i then M._insert(items[i * 2]) end