Make `Doc:get_selection[s]` return if the selection was actually sorted

This commit is contained in:
Guldoman 2022-07-11 05:39:55 +02:00
parent e646f2fb28
commit e7c4bdfe8e
No known key found for this signature in database
GPG Key ID: EA928C8BDA1A8825
1 changed files with 4 additions and 4 deletions

View File

@ -146,8 +146,8 @@ end
-- curors can never swap positions; only merge or split, or change their position in cursor
-- order.
function Doc:get_selection(sort)
local idx, line1, col1, line2, col2 = self:get_selections(sort)({ self.selections, sort }, 0)
return line1, col1, line2, col2, sort
local idx, line1, col1, line2, col2, swap = self:get_selections(sort)({ self.selections, sort }, 0)
return line1, col1, line2, col2, swap
end
function Doc:get_selection_text(limit)
@ -183,9 +183,9 @@ end
local function sort_positions(line1, col1, line2, col2)
if line1 > line2 or line1 == line2 and col1 > col2 then
return line2, col2, line1, col1
return line2, col2, line1, col1, true
end
return line1, col1, line2, col2
return line1, col1, line2, col2, false
end
function Doc:set_selections(idx, line1, col1, line2, col2, swap, rm)