Merge pull request #889 from Guldoman/PR_move_to_selection

Move cursor to the beginning/end of its selection
This commit is contained in:
Jefferson González 2022-03-20 00:22:00 -04:00 committed by GitHub
commit 331c78faac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -578,18 +578,20 @@ commands["doc:move-to-previous-char"] = function()
for idx, line1, col1, line2, col2 in doc():get_selections(true) do
if line1 ~= line2 or col1 ~= col2 then
doc():set_selections(idx, line1, col1)
else
doc():move_to_cursor(idx, translate.previous_char)
end
end
doc():move_to(translate.previous_char)
end
commands["doc:move-to-next-char"] = function()
for idx, line1, col1, line2, col2 in doc():get_selections(true) do
if line1 ~= line2 or col1 ~= col2 then
doc():set_selections(idx, line2, col2)
else
doc():move_to_cursor(idx, translate.next_char)
end
end
doc():move_to(translate.next_char)
end
command.add("core.docview", commands)