[gnome-builder/wip/chergert/completion] completion: add missing line text function
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/completion] completion: add missing line text function
- Date: Mon, 4 Jun 2018 00:28:27 +0000 (UTC)
commit 4f87768a5aec0fdbd3f3875e459489ea63511124
Author: Christian Hergert <chergert redhat com>
Date: Sun Jun 3 17:26:08 2018 -0700
completion: add missing line text function
src/libide/completion/ide-completion-context.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/src/libide/completion/ide-completion-context.c b/src/libide/completion/ide-completion-context.c
index e8904d4e0..912278116 100644
--- a/src/libide/completion/ide-completion-context.c
+++ b/src/libide/completion/ide-completion-context.c
@@ -993,3 +993,26 @@ _ide_completion_context_iter_invalidates (IdeCompletionContext *self,
return gtk_text_iter_compare (&begin, iter) <= 0 &&
gtk_text_iter_compare (&end, iter) >= 0;
}
+
+/**
+ * ide_completion_context_get_line_text:
+ * @self: a #IdeCompletionContext
+ *
+ * This is a convenience helper to get the line text up until the insertion
+ * cursor for the current completion.
+ *
+ * Returns: a newly allocated string
+ *
+ * Since: 3.30
+ */
+gchar *
+ide_completion_context_get_line_text (IdeCompletionContext *self)
+{
+ GtkTextIter begin, end;
+
+ g_return_val_if_fail (IDE_IS_COMPLETION_CONTEXT (self), NULL);
+
+ ide_completion_context_get_bounds (self, &begin, &end);
+ gtk_text_iter_set_line_offset (&begin, 0);
+ return gtk_text_iter_get_slice (&begin, &end);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]