summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
Diffstat (limited to 'script/core')
-rw-r--r--script/core/completion/completion.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index cf794433..06b46de9 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -219,7 +219,7 @@ local function getSnip(source)
goto CONTINUE
end
local firstRow = guide.rowColOf(def.start)
- local lastRow = firstRow + context
+ local lastRow = math.min(guide.rowColOf(def.finish) + 1, firstRow + context)
local lastOffset = lines[lastRow] and (lines[lastRow] - 1) or #text
local snip = text:sub(lines[firstRow], lastOffset)
return snip