From 704e04396fe809d3f4f1f9de3e2a05c84e6a2b9f Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Thu, 17 Jun 2021 19:17:24 -0400 Subject: [PATCH] Rebased, and added the ability for ctrl to just create new cursors. --- data/core/commands/doc.lua | 4 ++-- data/core/docview.lua | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/data/core/commands/doc.lua b/data/core/commands/doc.lua index d54eb059..b428cc74 100644 --- a/data/core/commands/doc.lua +++ b/data/core/commands/doc.lua @@ -384,7 +384,7 @@ local commands = { end os.remove(filename) core.log("Removed \"%s\"", filename) - end + end, ["doc:create-cursor-previous-line"] = function() split_cursor(-1) @@ -394,7 +394,7 @@ local commands = { ["doc:create-cursor-next-line"] = function() split_cursor(1) doc():merge_cursors() - end, + end } diff --git a/data/core/docview.lua b/data/core/docview.lua index 1cccb486..446cf574 100644 --- a/data/core/docview.lua +++ b/data/core/docview.lua @@ -256,7 +256,11 @@ function DocView:on_mouse_pressed(button, x, y, clicks) end else local line, col = self:resolve_screen_position(x, y) - self.doc:set_selection(mouse_selection(self.doc, clicks, line, col, line, col)) + if keymap.modkeys["ctrl"] then + self.doc:add_selection(mouse_selection(self.doc, clicks, line, col, line, col)) + else + self.doc:set_selection(mouse_selection(self.doc, clicks, line, col, line, col)) + end self.mouse_selecting = { line, col, clicks = clicks } end core.blink_reset()