Added support for shift+click selecting

Resolves #71
Resolves #59
This commit is contained in:
rxi 2020-05-13 16:12:20 +01:00
parent 1f55fec94b
commit e4ae088bb5

View file

@ -2,6 +2,7 @@ local core = require "core"
local common = require "core.common" local common = require "core.common"
local config = require "core.config" local config = require "core.config"
local style = require "core.style" local style = require "core.style"
local keymap = require "core.keymap"
local translate = require "core.doc.translate" local translate = require "core.doc.translate"
local View = require "core.view" local View = require "core.view"
@ -207,7 +208,11 @@ function DocView:on_mouse_pressed(button, x, y, clicks)
end end
self.doc:set_selection(line + 1, 1, line, 1) self.doc:set_selection(line + 1, 1, line, 1)
else 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 self.mouse_selecting = true
end end
self.blink_timer = 0 self.blink_timer = 0