[gnome-builder/wip/vim] vim: escape any pending snippets when not in insert mode.



commit 399e2c58a248c15b682665e827ae746b5e238f58
Author: Christian Hergert <christian hergert me>
Date:   Mon Sep 29 22:18:51 2014 -0700

    vim: escape any pending snippets when not in insert mode.

 src/editor/gb-editor-vim.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index b7a13ac..a75827e 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -91,6 +91,13 @@ gb_editor_vim_set_mode (GbEditorVim     *vim,
   vim->priv->mode = mode;
 
   /*
+   * Switch to the "block mode" cursor for non-insert mode. We are totally
+   * abusing "overwrite" here simply to look more like VIM.
+   */
+  gtk_text_view_set_overwrite (vim->priv->text_view,
+                               (mode != GB_EDITOR_VIM_INSERT));
+
+  /*
    * If we are going back to navigation mode, stash our current buffer
    * position for use in commands like j and k.
    */
@@ -98,11 +105,11 @@ gb_editor_vim_set_mode (GbEditorVim     *vim,
     vim->priv->target_line_offset = gb_editor_vim_get_line_offset (vim);
 
   /*
-   * Switch to the "block mode" cursor for non-insert mode. We are totally
-   * abusing "overwrite" here simply to look more like VIM.
+   * If there are any snippets active, escape out of them.
    */
-  gtk_text_view_set_overwrite (vim->priv->text_view,
-                               (mode != GB_EDITOR_VIM_INSERT));
+  if ((mode != GB_EDITOR_VIM_INSERT) &&
+      GB_IS_SOURCE_VIEW (vim->priv->text_view))
+    gb_source_view_clear_snippets (GB_SOURCE_VIEW (vim->priv->text_view));
 
   /*
    * If we are are going to normal mode and are at the end of the line,


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