Show cursor at the start of the next line when selecting full lines (#761)

This was the previous behavior that regressed with the keymap clicks.

This also better shows that the selection extends to the next line.
This commit is contained in:
Guldoman 2023-06-09 15:37:08 +02:00 committed by GitHub
parent 595196f4fa
commit daaf247ad9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -359,7 +359,7 @@ local commands = {
["doc:select-lines"] = function(dv)
for idx, line1, _, line2 in dv.doc:get_selections(true) do
append_line_if_last_line(line2)
dv.doc:set_selections(idx, line1, 1, line2 + 1, 1)
dv.doc:set_selections(idx, line2 + 1, 1, line1, 1)
end
end,

View File

@ -317,7 +317,7 @@ function DocView:mouse_selection(doc, snap_type, line1, col1, line2, col2)
line1, col1 = translate.start_of_word(doc, line1, col1)
line2, col2 = translate.end_of_word(doc, line2, col2)
elseif snap_type == "lines" then
col1, col2 = 1, math.huge
col1, col2, line2 = 1, 1, line2 + 1
end
if swap then
return line2, col2, line1, col1