[gnome-builder] editor: chose more appropriate line when doing insertions.



commit 2acc7a39912d36a520d4afe868305232861a0625
Author: Christian Hergert <christian hergert me>
Date:   Mon Sep 15 15:29:58 2014 -0700

    editor: chose more appropriate line when doing insertions.
    
    Also, fix a potential double line removal that could cause state to
    get out of sync.

 src/editor/gb-source-change-monitor.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/editor/gb-source-change-monitor.c b/src/editor/gb-source-change-monitor.c
index d52caea..7764e61 100644
--- a/src/editor/gb-source-change-monitor.c
+++ b/src/editor/gb-source-change-monitor.c
@@ -148,6 +148,15 @@ get_line_mutation (const GtkTextIter *begin,
       EXIT;
     }
   else if ((line == begin_line) &&
+           gtk_text_iter_starts_line (begin) &&
+           gtk_text_iter_starts_line (end) &&
+           !gtk_text_iter_ends_line (end))
+    {
+      *delete_line = TRUE;
+      *is_changed = FALSE;
+      EXIT;
+    }
+  else if ((line == begin_line) &&
            ((begin_line + 1) == end_line) &&
            gtk_text_iter_ends_line (begin) &&
            gtk_text_iter_starts_line (end))
@@ -162,10 +171,10 @@ get_line_mutation (const GtkTextIter *begin,
       *is_changed = TRUE;
       EXIT;
     }
-  else if ((begin_offset == 0) && (end_offset == 0))
+  else if ((line == end_line) && (end_offset == 0))
     {
-      *delete_line = (line != begin_line);
-      *is_changed = TRUE;
+      *delete_line = FALSE;
+      *is_changed = FALSE;
       EXIT;
     }
   else if ((begin_offset == 0) && (line == begin_line) && (begin_line != end_line))


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