From e4ae088bb540d7e373c0ec2067b5ee7a8fb13357 Mon Sep 17 00:00:00 2001 From: rxi Date: Wed, 13 May 2020 16:12:20 +0100 Subject: [PATCH] Added support for shift+click selecting Resolves #71 Resolves #59 --- data/core/docview.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/data/core/docview.lua b/data/core/docview.lua index b372acf..77785a3 100644 --- a/data/core/docview.lua +++ b/data/core/docview.lua @@ -2,6 +2,7 @@ local core = require "core" local common = require "core.common" local config = require "core.config" local style = require "core.style" +local keymap = require "core.keymap" local translate = require "core.doc.translate" local View = require "core.view" @@ -207,7 +208,11 @@ function DocView:on_mouse_pressed(button, x, y, clicks) end self.doc:set_selection(line + 1, 1, line, 1) else - self.doc:set_selection(line, col) + local line2, col2 + if keymap.modkeys["shift"] then + line2, col2 = select(3, self.doc:get_selection()) + end + self.doc:set_selection(line, col, line2, col2) self.mouse_selecting = true end self.blink_timer = 0