[gnome-text-editor] window: ignore position updates while busy



commit 1a36f38ac50535181818d8df17afbe58b532f8b1
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jul 28 17:16:44 2021 -0700

    window: ignore position updates while busy
    
    That way we don't supriously update while the document is loading. This
    is especially problematic on files with long lines.

 src/editor-window.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/editor-window.c b/src/editor-window.c
index 0f1455d..1af7f31 100644
--- a/src/editor-window.c
+++ b/src/editor-window.c
@@ -75,21 +75,25 @@ editor_window_cursor_moved_cb (EditorWindow   *self,
                                EditorDocument *document)
 {
   EditorPage *page;
+  guint line;
+  guint column;
 
   g_assert (EDITOR_IS_WINDOW (self));
   g_assert (self->position_label != NULL);
   g_assert (EDITOR_IS_POSITION_LABEL (self->position_label));
   g_assert (EDITOR_IS_DOCUMENT (document));
 
-  if ((page = editor_window_get_visible_page (self)))
-    {
-      guint line;
-      guint column;
+  if (!(page = editor_window_get_visible_page (self)))
+    return;
+
+  if (editor_document_get_busy (document))
+    return;
 
-      editor_page_get_visual_position (page, &line, &column);
+  if (editor_page_get_document (page) != document)
+    return;
 
-      _editor_position_label_set_position (self->position_label, line + 1, column + 1);
-    }
+  editor_page_get_visual_position (page, &line, &column);
+  _editor_position_label_set_position (self->position_label, line + 1, column + 1);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]