MessageTextView: Remove placeholder on paste

Fixes #8975
This commit is contained in:
Philipp Hörist 2018-03-25 01:39:16 +01:00
parent 6bd6294ab2
commit f7d9c16735
1 changed files with 9 additions and 2 deletions

View File

@ -88,7 +88,8 @@ class MessageTextView(Gtk.TextView):
self.begin_tags['strike'] = '<span style="text-decoration: line-through;">'
self.end_tags['strike'] = '</span>'
self.connect_after('paste-clipboard', self.after_paste_clipboard)
self.connect('paste-clipboard', self._paste_clipboard)
self.connect_after('paste-clipboard', self._after_paste_clipboard)
self.connect('focus-in-event', self._on_focus_in)
self.connect('focus-out-event', self._on_focus_out)
@ -139,7 +140,13 @@ class MessageTextView(Gtk.TextView):
def remove_placeholder(self):
self._on_focus_in()
def after_paste_clipboard(self, textview):
@staticmethod
def _paste_clipboard(textview):
if textview.is_placeholder():
textview.get_buffer().set_text('')
@staticmethod
def _after_paste_clipboard(textview):
buffer_ = textview.get_buffer()
mark = buffer_.get_insert()
iter_ = buffer_.get_iter_at_mark(mark)