[gnome-builder] snippets: ensure filters can be run on named variables



commit a8ab95068bf0f0279ab9f71b49f4f05ad46bbbe5
Author: Christian Hergert <christian hergert me>
Date:   Mon Sep 8 22:28:48 2014 -0700

    snippets: ensure filters can be run on named variables
    
    This fixes named variables so you can do something like:
    
     ${1:$filename|stripsuffix|camelize}
    
    Pretty handy for default structures based on filename.

 src/editor/gb-source-snippet-context.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/editor/gb-source-snippet-context.c b/src/editor/gb-source-snippet-context.c
index 87f1f9e..f17495f 100644
--- a/src/editor/gb-source-snippet-context.c
+++ b/src/editor/gb-source-snippet-context.c
@@ -451,8 +451,12 @@ gb_source_snippet_context_expand (GbSourceSnippetContext *context,
                   lkey = g_strndup (input, strchr (input, '|') - input);
                   expand = gb_source_snippet_context_get_variable (context, lkey);
                   if (expand)
-                    g_string_append (str, expand);
-                  input = strchr (input, '|');
+                    {
+                      g_string_append (str, expand);
+                      input = strchr (input, '|') - 1;
+                    }
+                  else
+                    input += strlen (input) - 1;
                 }
               else
                 {


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