Don't sort in `Doc:get_selection_idx` with an invalid index
This commit is contained in:
parent
9951e785b6
commit
b029f5993e
|
@ -168,7 +168,7 @@ end
|
||||||
---@return integer,integer,integer,integer,boolean? @line1, col1, line2, col2, was the selection sorted
|
---@return integer,integer,integer,integer,boolean? @line1, col1, line2, col2, was the selection sorted
|
||||||
function Doc:get_selection_idx(idx, sort)
|
function Doc:get_selection_idx(idx, sort)
|
||||||
local line1, col1, line2, col2 = self.selections[idx*4-3], self.selections[idx*4-2], self.selections[idx*4-1], self.selections[idx*4]
|
local line1, col1, line2, col2 = self.selections[idx*4-3], self.selections[idx*4-2], self.selections[idx*4-1], self.selections[idx*4]
|
||||||
if sort then
|
if line1 and sort then
|
||||||
return sort_positions(line1, col1, line2, col2)
|
return sort_positions(line1, col1, line2, col2)
|
||||||
else
|
else
|
||||||
return line1, col1, line2, col2
|
return line1, col1, line2, col2
|
||||||
|
|
Loading…
Reference in New Issue