From 7ca4c948bf19d4b43be983130030c6508f61fa07 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Mon, 24 Jun 2024 05:17:49 +0200 Subject: [PATCH] fix(doc): convert `Doc:merge_cursors` parameter from "selection index" to table index --- data/core/doc/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/core/doc/init.lua b/data/core/doc/init.lua index e44610e5..379a5d18 100644 --- a/data/core/doc/init.lua +++ b/data/core/doc/init.lua @@ -242,7 +242,8 @@ function Doc:set_selection(line1, col1, line2, col2, swap) end 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 if self.selections[i] == self.selections[j] and self.selections[i + 1] == self.selections[j + 1] then