Don't sort in `Doc:get_selection_idx` with an invalid index

This commit is contained in:
Guldoman 2022-11-02 21:11:41 +01:00
parent 9951e785b6
commit b029f5993e
No known key found for this signature in database
GPG Key ID: EA928C8BDA1A8825
1 changed files with 1 additions and 1 deletions

View File

@ -168,7 +168,7 @@ end
---@return integer,integer,integer,integer,boolean? @line1, col1, line2, col2, was the selection sorted
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]
if sort then
if line1 and sort then
return sort_positions(line1, col1, line2, col2)
else
return line1, col1, line2, col2