[gnome-builder/wip/vim] vim: implement <Control>B to go back a page.



commit 0df903660819b5f75d476a21acfadadecb9395cb
Author: Christian Hergert <christian hergert me>
Date:   Wed Oct 1 15:23:42 2014 -0700

    vim: implement <Control>B to go back a page.

 src/editor/gb-editor-vim.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 351ea09..12a30a8 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -1331,6 +1331,18 @@ gb_editor_vim_search (GbEditorVim *vim)
     }
 }
 
+static void
+gb_editor_vim_page_up (GbEditorVim *vim)
+{
+  g_assert (GB_IS_EDITOR_VIM (vim));
+
+  g_signal_emit_by_name (vim->priv->text_view,
+                         "move-cursor",
+                         GTK_MOVEMENT_PAGES,
+                         -1,
+                         FALSE);
+}
+
 static gboolean
 gb_editor_vim_get_has_selection (GbEditorVim *vim)
 {
@@ -1469,7 +1481,10 @@ gb_editor_vim_handle_normal (GbEditorVim *vim,
       /*
        * Move backward by one word.
        */
-      gb_editor_vim_move_backward_word (vim);
+      if ((event->state & GDK_CONTROL_MASK) != 0)
+        gb_editor_vim_page_up (vim);
+      else
+        gb_editor_vim_move_backward_word (vim);
       return TRUE;
 
     case GDK_KEY_x:


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