[gnome-builder/wip/commands] vim: return true from execute_command() if the command was recognized.



commit 46ee0d3ce67efcb9ed9ad485f23e059e0d12297f
Author: Christian Hergert <christian hergert me>
Date:   Tue Oct 7 13:46:57 2014 -0700

    vim: return true from execute_command() if the command was recognized.

 src/editor/gb-editor-vim.c |   15 +++++++++++----
 src/editor/gb-editor-vim.h |    2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 2732469..b611641 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -3306,11 +3306,12 @@ gb_editor_vim_search_and_replace (GbEditorVim *vim,
   g_free (replace_text);
 }
 
-void
+gboolean
 gb_editor_vim_execute_command (GbEditorVim *vim,
                                const gchar *command)
 {
   GbEditorVimPrivate *priv;
+  gboolean ret = TRUE;
   gchar *copy;
 
   g_return_if_fail (GB_IS_EDITOR_VIM (vim));
@@ -3340,11 +3341,17 @@ gb_editor_vim_execute_command (GbEditorVim *vim,
   else if (g_str_has_prefix (copy, "%s"))
     gb_editor_vim_search_and_replace (vim, copy + strlen ("%s"));
   else
-    g_debug (" TODO: Command Execution Support: %s", command);
+    ret = FALSE;
+
+  if (ret)
+    {
+      gb_editor_vim_clear_selection (vim);
+      gb_editor_vim_set_mode (vim, GB_EDITOR_VIM_NORMAL);
+    }
 
-  gb_editor_vim_clear_selection (vim);
-  gb_editor_vim_set_mode (vim, GB_EDITOR_VIM_NORMAL);
   g_free (copy);
+
+  return ret;
 }
 
 static void
diff --git a/src/editor/gb-editor-vim.h b/src/editor/gb-editor-vim.h
index fd96400..ae45fd6 100644
--- a/src/editor/gb-editor-vim.h
+++ b/src/editor/gb-editor-vim.h
@@ -79,7 +79,7 @@ gboolean         gb_editor_vim_get_enabled     (GbEditorVim     *vim);
 void             gb_editor_vim_set_enabled     (GbEditorVim     *vim,
                                                 gboolean         enabled);
 GtkWidget       *gb_editor_vim_get_text_view   (GbEditorVim     *vim);
-void             gb_editor_vim_execute_command (GbEditorVim     *vim,
+gboolean         gb_editor_vim_execute_command (GbEditorVim     *vim,
                                                 const gchar     *command);
 
 G_END_DECLS


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