[gtksourceview/wip/chergert/vim: 57/73] stub out paragraph/sentence motion




commit ed8d54e6160054a9bdb015d4e92cef21e3b36437
Author: Christian Hergert <chergert redhat com>
Date:   Sat Oct 23 16:08:13 2021 -0700

    stub out paragraph/sentence motion

 gtksourceview/vim/gtk-source-vim-motion.c | 42 +++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-motion.c b/gtksourceview/vim/gtk-source-vim-motion.c
index abcc6fd7..4405a180 100644
--- a/gtksourceview/vim/gtk-source-vim-motion.c
+++ b/gtksourceview/vim/gtk-source-vim-motion.c
@@ -708,6 +708,34 @@ motion_F_char (GtkTextIter        *iter,
        return FALSE;
 }
 
+static gboolean
+motion_forward_sentence_start (GtkTextIter        *iter,
+                               GtkSourceVimMotion *state)
+{
+       return FALSE;
+}
+
+static gboolean
+motion_backward_sentence_start (GtkTextIter        *iter,
+                                GtkSourceVimMotion *state)
+{
+       return FALSE;
+}
+
+static gboolean
+motion_forward_paragraph_start (GtkTextIter        *iter,
+                                GtkSourceVimMotion *state)
+{
+       return FALSE;
+}
+
+static gboolean
+motion_backward_paragraph_start (GtkTextIter        *iter,
+                                 GtkSourceVimMotion *state)
+{
+       return FALSE;
+}
+
 GtkSourceVimState *
 gtk_source_vim_motion_new (void)
 {
@@ -888,10 +916,20 @@ gtk_source_vim_motion_handle_keypress (GtkSourceVimState *state,
                        self->motion = motion_F_char;
                        return TRUE;
 
-               case GDK_KEY_n:
-               case GDK_KEY_N:
                case GDK_KEY_parenleft:
+                       return gtk_source_vim_motion_complete (self, motion_backward_sentence_start);
+
                case GDK_KEY_parenright:
+                       return gtk_source_vim_motion_complete (self, motion_forward_sentence_start);
+
+               case GDK_KEY_braceleft:
+                       return gtk_source_vim_motion_complete (self, motion_backward_paragraph_start);
+
+               case GDK_KEY_braceright:
+                       return gtk_source_vim_motion_complete (self, motion_forward_paragraph_start);
+
+               case GDK_KEY_n:
+               case GDK_KEY_N:
                case GDK_KEY_percent:
                        /* TODO */
                        G_GNUC_FALLTHROUGH;


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