From 06ffc3826da821a27aad23f95f9a3b5b8b78358e Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Mon, 1 Nov 2021 15:18:57 +0100 Subject: [PATCH] update end of selection when using click + shift --- bigtext.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bigtext.py b/bigtext.py index 089d13d..0b28301 100644 --- a/bigtext.py +++ b/bigtext.py @@ -178,7 +178,13 @@ class InnerBigText(QWidget): self.parent.v_scroll_bar.setValue(self._byte_offset) def mousePressEvent(self, e: QtGui.QMouseEvent) -> None: - if e.buttons() == Qt.MouseButton.LeftButton: + if e.buttons() == Qt.MouseButton.LeftButton and e.modifiers() == Qt.KeyboardModifier.ShiftModifier: + offset = self.to_byte_offset(e) + self.selection_highlight.set_end_byte(offset) + self.update() + return + + if e.buttons() == Qt.MouseButton.LeftButton and e.modifiers() == Qt.KeyboardModifier.NoModifier: offset = self.to_byte_offset(e) self.selection_highlight.set_start(offset) self.selection_highlight.set_end_byte(offset)