From 266058b017447d5c40bb3cff9d61bc5b8c0ad97d Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 27 Sep 2008 16:27:11 -0400 Subject: Fixed modules/textadept/lsnippets.lua bug for placeholders. If placeholders occured just before an EOL, Scintilla regex matching cannot recognize newline characters as [^(]. Had to explicitly search for the case where an EOL occurs after the placeholder being searched for. --- modules/textadept/lsnippets.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/textadept/lsnippets.lua') diff --git a/modules/textadept/lsnippets.lua b/modules/textadept/lsnippets.lua index bc479011..221ea3a0 100644 --- a/modules/textadept/lsnippets.lua +++ b/modules/textadept/lsnippets.lua @@ -228,6 +228,11 @@ function next() buffer:set_sel(s, s + #next_item) else -- use the first mirror as a placeholder s, e = buffer:find('%'..index..'[^(]', 2097152, s_start) -- regexp + if not s and not e then + -- Scintilla cannot match [\r\n\f] in regexp mode; use '$' instead + s, e = buffer:find('%'..index..'$', 2097152, s_start) -- regexp + if e then e = e + 1 end + end if not s then snippet.index = index + 1 return next() end buffer:set_sel(s, e - 1) buffer:replace_sel('') end -- cgit v1.2.3