aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2008-09-27 16:27:11 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2008-09-27 16:27:11 -0400
commit266058b017447d5c40bb3cff9d61bc5b8c0ad97d (patch)
tree7798c777c2dc3239583c3403a1aa60565cde083c /modules
parente95e51cb99a947865644628d1a3b116ad69b9a01 (diff)
downloadtextadept-266058b017447d5c40bb3cff9d61bc5b8c0ad97d.tar.gz
textadept-266058b017447d5c40bb3cff9d61bc5b8c0ad97d.zip
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.
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/lsnippets.lua5
1 files changed, 5 insertions, 0 deletions
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