[gtksourceview/wip/chergert/vim: 276/293] use delete command instead of state




commit 842e96478048800588bf70a7eab1eb9d5dba3ec7
Author: Christian Hergert <chergert redhat com>
Date:   Wed Nov 3 16:53:56 2021 -0700

    use delete command instead of state

 gtksourceview/vim/gtk-source-vim-normal.c | 34 ++++++++-----------------------
 1 file changed, 8 insertions(+), 26 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-normal.c b/gtksourceview/vim/gtk-source-vim-normal.c
index e3502bda..ca753518 100644
--- a/gtksourceview/vim/gtk-source-vim-normal.c
+++ b/gtksourceview/vim/gtk-source-vim-normal.c
@@ -121,26 +121,6 @@ gtk_source_vim_normal_replace_one (GtkSourceVimNormal *self)
        return TRUE;
 }
 
-G_GNUC_NULL_TERMINATED
-static void
-gtk_source_vim_normal_begin_delete (GtkSourceVimNormal *self,
-                                    GtkSourceVimState  *motion,
-                                    ...)
-{
-       GtkSourceVimState *del;
-
-       g_assert (GTK_SOURCE_IS_VIM_NORMAL (self));
-       g_assert (!motion || GTK_SOURCE_IS_VIM_MOTION (motion));
-
-       del = gtk_source_vim_delete_new (GTK_SOURCE_VIM_MOTION (motion));
-
-       gtk_source_vim_state_set_count (del, self->count);
-       gtk_source_vim_state_push (GTK_SOURCE_VIM_STATE (self), del);
-
-       if (motion != NULL)
-               gtk_source_vim_state_pop (del);
-}
-
 G_GNUC_NULL_TERMINATED
 static GtkSourceVimState *
 gtk_source_vim_normal_begin_change (GtkSourceVimNormal *self,
@@ -478,15 +458,17 @@ key_handler_command (GtkSourceVimNormal *self,
                case GDK_KEY_D:
                        if (self->count != 0)
                                return gtk_source_vim_normal_bail (self);
-                       gtk_source_vim_normal_begin_delete (self,
-                                                           gtk_source_vim_motion_new_line_end (),
-                                                           NULL);
+                       gtk_source_vim_normal_begin_command (self,
+                                                            gtk_source_vim_motion_new_line_end (),
+                                                            gtk_source_vim_motion_new_none (),
+                                                            ":delete", 0);
                        return TRUE;
 
                case GDK_KEY_x:
-                       gtk_source_vim_normal_begin_delete (self,
-                                                           gtk_source_vim_motion_new_forward_char (),
-                                                           NULL);
+                       gtk_source_vim_normal_begin_command (self,
+                                                            gtk_source_vim_motion_new_forward_char (),
+                                                            gtk_source_vim_motion_new_none (),
+                                                            ":delete", 0);
                        return TRUE;
 
                case GDK_KEY_S:


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