[gnome-builder] completion-words: avoid over activating



commit 604cac7fde3c2dcf1e7622942eb479543d3caf29
Author: Christian Hergert <chergert redhat com>
Date:   Wed Nov 2 21:09:44 2016 -0700

    completion-words: avoid over activating
    
    Ensure we don't activate unless we have a character to use.

 libide/sourceview/ide-completion-words.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/libide/sourceview/ide-completion-words.c b/libide/sourceview/ide-completion-words.c
index 65fa47e..75df744 100644
--- a/libide/sourceview/ide-completion-words.c
+++ b/libide/sourceview/ide-completion-words.c
@@ -51,9 +51,6 @@ ide_completion_words_match (GtkSourceCompletionProvider *provider,
   g_assert (IDE_IS_COMPLETION_WORDS (provider));
   g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context));
 
-  if (!gtk_source_completion_context_get_iter (context, &iter))
-    return FALSE;
-
   activation = gtk_source_completion_context_get_activation (context);
 
   if (activation == GTK_SOURCE_COMPLETION_ACTIVATION_INTERACTIVE)
@@ -62,6 +59,17 @@ ide_completion_words_match (GtkSourceCompletionProvider *provider,
         return FALSE;
     }
 
+  if (!gtk_source_completion_context_get_iter (context, &iter))
+    return FALSE;
+
+  if (gtk_text_iter_backward_char (&iter))
+    {
+      gunichar ch = gtk_text_iter_get_char (&iter);
+
+      if (!g_unichar_isalnum (ch))
+        return FALSE;
+    }
+
   return TRUE;
 }
 


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