summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-14 22:19:12 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-14 22:19:12 +0800
commit4701342d87327310fa99b0926d02eaedaaecc590 (patch)
treef6c66e5a9d6744015f7708007023e89d31851874
parent0115abdc5438189b9c0f0c1a5b1946a7ee1f85a7 (diff)
downloadlua-language-server-4701342d87327310fa99b0926d02eaedaaecc590.zip
assert
-rw-r--r--script/text-merger.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/script/text-merger.lua b/script/text-merger.lua
index be04baac..28f32a2a 100644
--- a/script/text-merger.lua
+++ b/script/text-merger.lua
@@ -56,6 +56,12 @@ local function mergeRows(rows, change)
local left = getLeft(rows[startLine], startChar)
local right = getRight(rows[endLine], endChar)
-- 先把双方的行数调整成一致
+ if endLine > #rows then
+ log.error('NMD, WSM `endLine > #rows` ?')
+ for i = #rows + 1, endLine do
+ rows[i] = ''
+ end
+ end
local delta = #insertRows - (endLine - startLine + 1)
if delta ~= 0 then
table.move(rows, endLine, #rows, endLine + delta)