aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/snippets.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2018-11-12 12:31:52 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2018-11-12 12:31:52 -0500
commita0db06b907c8f480226e5758885a0590b29afdc7 (patch)
tree754bb91fd41bb4f97f83cc0e335e5b4adca7c1bd /modules/textadept/snippets.lua
parentd751e91b06f56fd71ae3b31205aa1673d6012718 (diff)
downloadtextadept-a0db06b907c8f480226e5758885a0590b29afdc7.tar.gz
textadept-a0db06b907c8f480226e5758885a0590b29afdc7.zip
Handle potential mismatch between snippet in buffer and snippet in memory.
Snippet prev/next coupled with subsequent edits may cause the buffer to contain an unexpected snippet placeholder. Handle it gracefully.
Diffstat (limited to 'modules/textadept/snippets.lua')
-rw-r--r--modules/textadept/snippets.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index f7239ef3..c7ff417a 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -551,7 +551,8 @@ M._snippet_mt = {
end
local id = buffer:indicator_value_at(M.INDIC_PLACEHOLDER, s)
local ph = snapshot.placeholders[id]
- if (not index or ph.index == index) and (not type or ph[type]) then
+ if ph and (not index or ph.index == index) and
+ (not type or ph[type]) then
return s, ph
end
s = buffer:indicator_end(M.INDIC_PLACEHOLDER, i)