[gnome-builder] snippets: only treat chunks starting with $ as dynamic.



commit c69bbaf2b9180ee20b34654f5daf3662ab7b362a
Author: Christian Hergert <christian hergert me>
Date:   Tue Sep 9 15:22:06 2014 -0700

    snippets: only treat chunks starting with $ as dynamic.

 src/editor/gb-source-snippet-context.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/editor/gb-source-snippet-context.c b/src/editor/gb-source-snippet-context.c
index f17495f..7419fa6 100644
--- a/src/editor/gb-source-snippet-context.c
+++ b/src/editor/gb-source-snippet-context.c
@@ -400,6 +400,7 @@ gb_source_snippet_context_expand (GbSourceSnippetContext *context,
   GbSourceSnippetContextPrivate *priv;
   const gchar *expand;
   gunichar c;
+  gboolean is_dynamic;
   GString *str;
   gchar key[12];
   gint n;
@@ -410,6 +411,8 @@ gb_source_snippet_context_expand (GbSourceSnippetContext *context,
 
   priv = context->priv;
 
+  is_dynamic = (*input == '$');
+
   str = g_string_new (NULL);
 
   for (; *input; input = g_utf8_next_char (input))
@@ -422,7 +425,7 @@ gb_source_snippet_context_expand (GbSourceSnippetContext *context,
             break;
           c = g_utf8_get_char (input);
         }
-      else if (c == '$')
+      else if (is_dynamic && c == '$')
         {
           input = g_utf8_next_char (input);
           if (!*input)
@@ -473,7 +476,7 @@ gb_source_snippet_context_expand (GbSourceSnippetContext *context,
               continue;
             }
         }
-      else if (c == '|')
+      else if (is_dynamic && c == '|')
         return apply_filters (str, input + 1);
       else if (c == '\t')
         {


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