fix(doc): convert `Doc:merge_cursors` parameter from "selection index" to table index

This commit is contained in:
Guldoman 2024-06-24 05:17:49 +02:00 committed by Takase
parent 6cbfa44c95
commit 7ca4c948bf
1 changed files with 2 additions and 1 deletions

View File

@ -242,7 +242,8 @@ function Doc:set_selection(line1, col1, line2, col2, swap)
end end
function Doc:merge_cursors(idx) function Doc:merge_cursors(idx)
for i = (idx or (#self.selections - 3)), (idx or 5), -4 do local table_index = idx and (idx - 1) * 4
for i = (table_index or (#self.selections - 3)), (table_index or 5), -4 do
for j = 1, i - 4, 4 do for j = 1, i - 4, 4 do
if self.selections[i] == self.selections[j] and if self.selections[i] == self.selections[j] and
self.selections[i + 1] == self.selections[j + 1] then self.selections[i + 1] == self.selections[j + 1] then