Adding the shift+click selection functionality

This commit is contained in:
Willie Lawrence 2020-05-10 13:31:27 -03:00
parent f7b54db1b4
commit 9badb0deb0
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
local DocView = require "core.docview"
local keymap = require "core.keymap"
local on_mouse_pressed = DocView.on_mouse_pressed
DocView.on_mouse_pressed = function(self, button, x, y, clicks)
local old_line, old_col = self.doc:get_selection(true)
on_mouse_pressed(self, button, x, y, clicks)
if (keymap.modkeys["shift"] and button == "left") then
local new_line, new_col = self.doc:get_selection(true)
self.doc:set_selection(new_line, new_col, old_line, old_col)
end
end