diff options
author | Sören Tempel <soeren+git@soeren-tempel.net> | 2021-05-23 11:28:08 +0200 |
---|---|---|
committer | Sören Tempel <soeren+git@soeren-tempel.net> | 2021-05-23 11:28:08 +0200 |
commit | eac3b07c85d8805998af8f617f494ba82063fc86 (patch) | |
tree | 30cf1da6832e4e5ae92f8f529e929b3ea5284d69 | |
parent | 02ebcc5aedf7163e1f9999245eb4ac3ddbe7a6fb (diff) |
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.
-rw-r--r-- | saneterm/termview.py | 6 |
1 files changed, 6 insertions, 0 deletions
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) |