aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/.buffer.luadoc2
-rw-r--r--modules/textadept/snippets.lua3
2 files changed, 3 insertions, 2 deletions
diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc
index 29b339d9..dfaa4edf 100644
--- a/core/.buffer.luadoc
+++ b/core/.buffer.luadoc
@@ -1928,7 +1928,7 @@ function indicator_clear_range(buffer, pos, length) end
---
-- Returns the next boundary position, starting from position *pos*, of
-- indicator number *indicator*, in the range of `0` to `31`.
--- Returns `buffer.length` if *indicator* was not found.
+-- Returns `0` if *indicator* was not found.
-- @param buffer A buffer.
-- @param indicator An indicator number in the range of `0` to `31`.
-- @param pos The position in *buffer* of the indicator.
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index d9f30d52..cac83b7b 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -155,7 +155,8 @@ local function new_snippet(text, trigger)
index = 0, max_index = 0, snapshots = {},
}, {__index = function(self, k)
if k == 'end_pos' then
- return buffer:indicator_end(INDIC_SNIPPET, self.start_pos)
+ local end_pos = buffer:indicator_end(INDIC_SNIPPET, self.start_pos)
+ return end_pos > self.start_pos and end_pos or self.start_pos
elseif k == 'placeholder_pos' then
-- Normally the marker is one character behind the placeholder. However
-- it will not exist at all if the placeholder is at the beginning of the