forked from Mirrors/apostrophe
Don't scroll when opening documents, only when pasting text
parent
05cdfe0599
commit
b4696cda30
|
@ -62,6 +62,7 @@ class TextView(Gtk.TextView):
|
||||||
# General behavior
|
# General behavior
|
||||||
self.connect('size-allocate', self.on_size_allocate)
|
self.connect('size-allocate', self.on_size_allocate)
|
||||||
self.get_buffer().connect('changed', self.on_text_changed)
|
self.get_buffer().connect('changed', self.on_text_changed)
|
||||||
|
self.get_buffer().connect('paste-done', self.on_paste_done)
|
||||||
|
|
||||||
# Spell checking
|
# Spell checking
|
||||||
self.spellcheck = True
|
self.spellcheck = True
|
||||||
|
@ -148,6 +149,8 @@ class TextView(Gtk.TextView):
|
||||||
|
|
||||||
def on_text_changed(self, *_):
|
def on_text_changed(self, *_):
|
||||||
self.markup.apply()
|
self.markup.apply()
|
||||||
|
|
||||||
|
def on_paste_done(self, *_):
|
||||||
self.smooth_scroll_to()
|
self.smooth_scroll_to()
|
||||||
|
|
||||||
def on_parent_set(self, *_):
|
def on_parent_set(self, *_):
|
||||||
|
@ -163,7 +166,8 @@ class TextView(Gtk.TextView):
|
||||||
def on_mark_set(self, _text_buffer, _location, mark, _data=None):
|
def on_mark_set(self, _text_buffer, _location, mark, _data=None):
|
||||||
if mark.get_name() == 'selection_bound':
|
if mark.get_name() == 'selection_bound':
|
||||||
self.markup.apply()
|
self.markup.apply()
|
||||||
self.smooth_scroll_to(mark)
|
if not self.get_buffer().get_has_selection():
|
||||||
|
self.smooth_scroll_to(mark)
|
||||||
elif mark.get_name() == 'gtk_drag_target':
|
elif mark.get_name() == 'gtk_drag_target':
|
||||||
self.smooth_scroll_to(mark)
|
self.smooth_scroll_to(mark)
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue