[gnome-builder/wip/gtk4-port] plugins/clang: cleanup chunk retrieval
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/clang: cleanup chunk retrieval
- Date: Sat, 14 May 2022 02:38:37 +0000 (UTC)
commit e9556afd38676cb60355b75d6a276699d779aa2a
Author: Christian Hergert <chergert redhat com>
Date: Fri May 13 17:45:15 2022 -0700
plugins/clang: cleanup chunk retrieval
src/plugins/clang/ide-clang-completion-provider.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/clang/ide-clang-completion-provider.c
b/src/plugins/clang/ide-clang-completion-provider.c
index c3ea71eb0..24c4b4baa 100644
--- a/src/plugins/clang/ide-clang-completion-provider.c
+++ b/src/plugins/clang/ide-clang-completion-provider.c
@@ -175,6 +175,7 @@ ide_clang_completion_provider_activate (GtkSourceCompletionProvider *provider,
GtkSourceBuffer *buffer;
GtkSourceView *view;
GtkTextIter begin, end;
+ guint n_chunks;
g_assert (IDE_IS_CLANG_COMPLETION_PROVIDER (self));
g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context));
@@ -213,17 +214,18 @@ ide_clang_completion_provider_activate (GtkSourceCompletionProvider *provider,
gtk_text_buffer_delete (GTK_TEXT_BUFFER (buffer), &begin, &end);
snippet = ide_clang_completion_item_get_snippet (item, file_settings);
+ n_chunks = gtk_source_snippet_get_n_chunks (snippet);
/* Check the last snippet chunk and see if it matches our current
* position so we can omit it.
*/
- if (gtk_source_snippet_get_n_chunks (snippet) > 0)
+ if (n_chunks > 0)
{
GtkSourceSnippetChunk *chunk;
const gchar *text;
GtkTextIter limit;
- chunk = gtk_source_snippet_get_nth_chunk (snippet, gtk_source_snippet_get_n_chunks (snippet) - 1);
+ chunk = gtk_source_snippet_get_nth_chunk (snippet, n_chunks-1);
text = gtk_source_snippet_chunk_get_text (chunk);
limit = end;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]