[gnome-builder/wip/libide] libide: fix snippet expansion



commit c1375539152ecf22934bcc3c926b41523671eaa6
Author: Christian Hergert <christian hergert me>
Date:   Mon Mar 16 13:02:39 2015 -0700

    libide: fix snippet expansion
    
    Setting text should not default to setting text_set.

 libide/clang/ide-clang-completion-item.c |    7 +++++++
 libide/ide-source-snippet-chunk.c        |    1 -
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/libide/clang/ide-clang-completion-item.c b/libide/clang/ide-clang-completion-item.c
index 99030cf..8ec5547 100644
--- a/libide/clang/ide-clang-completion-item.c
+++ b/libide/clang/ide-clang-completion-item.c
@@ -208,6 +208,7 @@ ide_clang_completion_item_lazy_init (IdeClangCompletionItem *self)
           g_string_append_printf (markup, "<b>%s</b>", escaped);
           chunk = ide_source_snippet_chunk_new ();
           ide_source_snippet_chunk_set_text (chunk, text);
+          ide_source_snippet_chunk_set_text_set (chunk, TRUE);
           ide_source_snippet_add_chunk (snippet, chunk);
           g_clear_object (&chunk);
           break;
@@ -216,6 +217,7 @@ ide_clang_completion_item_lazy_init (IdeClangCompletionItem *self)
           g_string_append (markup, escaped);
           chunk = ide_source_snippet_chunk_new ();
           ide_source_snippet_chunk_set_text (chunk, text);
+          ide_source_snippet_chunk_set_text_set (chunk, TRUE);
           ide_source_snippet_add_chunk (snippet, chunk);
           g_clear_object (&chunk);
           break;
@@ -224,6 +226,7 @@ ide_clang_completion_item_lazy_init (IdeClangCompletionItem *self)
           g_string_append (markup, escaped);
           chunk = ide_source_snippet_chunk_new ();
           ide_source_snippet_chunk_set_text (chunk, text);
+          ide_source_snippet_chunk_set_text_set (chunk, TRUE);
           ide_source_snippet_chunk_set_tab_stop (chunk, ++tab_stop);
           ide_source_snippet_add_chunk (snippet, chunk);
           g_clear_object (&chunk);
@@ -241,6 +244,7 @@ ide_clang_completion_item_lazy_init (IdeClangCompletionItem *self)
           g_string_append (markup, " ");
           chunk = ide_source_snippet_chunk_new ();
           ide_source_snippet_chunk_set_text (chunk, " ");
+          ide_source_snippet_chunk_set_text_set (chunk, TRUE);
           ide_source_snippet_add_chunk (snippet, chunk);
           g_clear_object (&chunk);
           /* fall through */
@@ -259,6 +263,7 @@ ide_clang_completion_item_lazy_init (IdeClangCompletionItem *self)
           g_string_append (markup, escaped);
           chunk = ide_source_snippet_chunk_new ();
           ide_source_snippet_chunk_set_text (chunk, text);
+          ide_source_snippet_chunk_set_text_set (chunk, TRUE);
           ide_source_snippet_add_chunk (snippet, chunk);
           g_clear_object (&chunk);
           break;
@@ -268,11 +273,13 @@ ide_clang_completion_item_lazy_init (IdeClangCompletionItem *self)
           /* insert the vertical space */
           chunk = ide_source_snippet_chunk_new ();
           ide_source_snippet_chunk_set_text (chunk, text);
+          ide_source_snippet_chunk_set_text_set (chunk, TRUE);
           ide_source_snippet_add_chunk (snippet, chunk);
           g_clear_object (&chunk);
           /* now perform indentation */
           chunk = ide_source_snippet_chunk_new ();
           ide_source_snippet_chunk_set_text (chunk, "\t");
+          ide_source_snippet_chunk_set_text_set (chunk, TRUE);
           ide_source_snippet_add_chunk (snippet, chunk);
           g_clear_object (&chunk);
           break;
diff --git a/libide/ide-source-snippet-chunk.c b/libide/ide-source-snippet-chunk.c
index db845f0..f86fa23 100644
--- a/libide/ide-source-snippet-chunk.c
+++ b/libide/ide-source-snippet-chunk.c
@@ -191,7 +191,6 @@ ide_source_snippet_chunk_set_text (IdeSourceSnippetChunk *chunk,
     {
       g_free (chunk->text);
       chunk->text = g_strdup (text);
-      chunk->text_set = (chunk->text != NULL);
       g_object_notify_by_pspec (G_OBJECT (chunk), gParamSpecs[PROP_TEXT]);
     }
 }


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