From eac3b07c85d8805998af8f617f494ba82063fc86 Mon Sep 17 00:00:00 2001 From: Sören Tempel Date: Sun, 23 May 2021 11:28:08 +0200 Subject: termview: Ensure that cursor is not part of a selection Otherwise, when typing a word directly after the output point selecting this word and attempting to delete it using backspace doesn't work. Seems to me, if text is selected Gtk treats the beginning of this selected test as the current cursor position. --- saneterm/termview.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/saneterm/termview.py b/saneterm/termview.py index 853390a..9f40af8 100644 --- a/saneterm/termview.py +++ b/saneterm/termview.py @@ -81,12 +81,18 @@ class TermView(Gtk.TextView): self._last_mark = self._last_mark def cursor_at_out(self): + if self._textbuffer.get_has_selection(): + return False + cur = self._textbuffer.get_iter_at_offset(self._textbuffer.props.cursor_position) out = self._textbuffer.get_iter_at_mark(self._last_output_mark) return cur.compare(out) == 0 def cursor_at_end(self): + if self._textbuffer.get_has_selection(): + return False + cur = self._textbuffer.get_iter_at_offset(self._textbuffer.props.cursor_position) end = self._textbuffer.get_iter_at_mark(self._last_mark) -- cgit 1.4.1