[gedit] tab: after loading, no need to scroll to cursor if already at start
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] tab: after loading, no need to scroll to cursor if already at start
- Date: Tue, 26 Jul 2022 22:29:24 +0000 (UTC)
commit be6c7695d457b1054b0616f1609d452f86210923
Author: Sébastien Wilmet <swilmet informatique-libre be>
Date: Wed Jul 27 00:18:15 2022 +0200
tab: after loading, no need to scroll to cursor if already at start
Especially useful if the org.gnome.gedit.preferences.editor
restore-cursor-position gsetting is set to false, and if the file is
loaded without specifying a position.
In that case the cursor will be placed at the start, so no need to setup
the idle+timeout.
gedit/gedit-tab.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 65f3953a2..bede8d914 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -1710,7 +1710,8 @@ goto_line (GTask *loading_task)
* an idle as after the document is loaded the textview is still
* redrawing and relocating its internals.
*/
- if (data->tab->scroll_idle == 0)
+ if (data->tab->scroll_idle == 0 &&
+ !gtk_text_iter_is_start (&iter))
{
data->tab->scroll_idle = g_idle_add ((GSourceFunc)scroll_idle_cb, data->tab);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]