[gnome-builder/wip/vim] vim: plumb command line GString for use in command mode.



commit 1f1eb1a5b51fb897a2861fb0360a25e6fc40666a
Author: Christian Hergert <christian hergert me>
Date:   Tue Sep 30 17:38:55 2014 -0700

    vim: plumb command line GString for use in command mode.

 src/editor/gb-editor-vim.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 18896b2..121fc2b 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -28,6 +28,7 @@
 struct _GbEditorVimPrivate
 {
   GtkTextView     *text_view;
+  GString         *command_line;
   GbEditorVimMode  mode;
   gulong           key_press_event_handler;
   gulong           mark_set_handler;
@@ -112,6 +113,12 @@ gb_editor_vim_set_mode (GbEditorVim     *vim,
     gb_source_view_clear_snippets (GB_SOURCE_VIEW (vim->priv->text_view));
 
   /*
+   * Clear the command line text.
+   */
+  if (vim->priv->command_line->len)
+    g_string_truncate (vim->priv->command_line, 0);
+
+  /*
    * If we are are going to normal mode and are at the end of the line,
    * then move back a character so we are on the last character as opposed
    * to after it. This matches closer to VIM.
@@ -1902,6 +1909,9 @@ gb_editor_vim_finalize (GObject *object)
       priv->text_view = NULL;
     }
 
+  g_string_free (priv->command_line, TRUE);
+  priv->command_line = NULL;
+
   G_OBJECT_CLASS (gb_editor_vim_parent_class)->finalize (object);
 }
 
@@ -2004,6 +2014,7 @@ gb_editor_vim_init (GbEditorVim *vim)
   vim->priv = gb_editor_vim_get_instance_private (vim);
   vim->priv->enabled = FALSE;
   vim->priv->mode = GB_EDITOR_VIM_NORMAL;
+  vim->priv->command_line = g_string_new (NULL);
 }
 
 GType


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