[gnome-builder] vim: implement '?' command



commit 18dc0d96ad369036944e373541d113048b5e41c5
Author: Ray Strode <rstrode redhat com>
Date:   Tue Jan 27 22:56:46 2015 -0500

    vim: implement '?' command
    
    The '?' command is just like the '/' but in reverse.
    This commit adds support for it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743668

 src/vim/gb-source-vim.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/src/vim/gb-source-vim.c b/src/vim/gb-source-vim.c
index aea3f60..e61328c 100644
--- a/src/vim/gb-source-vim.c
+++ b/src/vim/gb-source-vim.c
@@ -4376,9 +4376,8 @@ gb_source_vim_cmd_repeat (GbSourceVim *vim,
 }
 
 static void
-gb_source_vim_cmd_begin_search (GbSourceVim *vim,
-                                guint        count,
-                                gchar        modifier)
+gb_source_vim_begin_search (GbSourceVim      *vim,
+                            GtkDirectionType  direction)
 {
   GtkTextBuffer *buffer;
   GtkTextIter begin;
@@ -4398,12 +4397,28 @@ gb_source_vim_cmd_begin_search (GbSourceVim *vim,
       text = gtk_text_iter_get_slice (&begin, &end);
     }
 
-  g_signal_emit (vim, gSignals [BEGIN_SEARCH], 0, GTK_DIR_DOWN, text);
+  g_signal_emit (vim, gSignals [BEGIN_SEARCH], 0, direction, text);
 
   g_free (text);
 }
 
 static void
+gb_source_vim_cmd_begin_search (GbSourceVim *vim,
+                                guint        count,
+                                gchar        modifier)
+{
+  gb_source_vim_begin_search (vim, GTK_DIR_DOWN);
+}
+
+static void
+gb_source_vim_cmd_begin_search_backward (GbSourceVim *vim,
+                                         guint        count,
+                                         gchar        modifier)
+{
+  gb_source_vim_begin_search (vim, GTK_DIR_UP);
+}
+
+static void
 gb_source_vim_cmd_forward_line_end (GbSourceVim *vim,
                                     guint        count,
                                     gchar        modifier)
@@ -5438,6 +5453,10 @@ gb_source_vim_class_init (GbSourceVimClass *klass)
                                         GB_SOURCE_VIM_COMMAND_FLAG_NONE,
                                         GB_SOURCE_VIM_COMMAND_JUMP,
                                         gb_source_vim_cmd_begin_search);
+  gb_source_vim_class_register_command (klass, '?',
+                                        GB_SOURCE_VIM_COMMAND_FLAG_NONE,
+                                        GB_SOURCE_VIM_COMMAND_JUMP,
+                                        gb_source_vim_cmd_begin_search_backward);
   gb_source_vim_class_register_command (klass, '$',
                                         GB_SOURCE_VIM_COMMAND_FLAG_NONE,
                                         GB_SOURCE_VIM_COMMAND_MOVEMENT,


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