[gtksourceview/wip/chergert/vim: 208/293] use current register for yank and paste




commit dd5046503ac22c05b7d2332006941452264611b6
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 2 12:11:16 2021 -0700

    use current register for yank and paste
    
    so that we inhert it from something like "myy or "zp

 gtksourceview/vim/gtk-source-vim-command.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-command.c b/gtksourceview/vim/gtk-source-vim-command.c
index 0c01c22e..34522b52 100644
--- a/gtksourceview/vim/gtk-source-vim-command.c
+++ b/gtksourceview/vim/gtk-source-vim-command.c
@@ -26,7 +26,6 @@
 #include "gtksourcebuffer.h"
 
 #include "gtk-source-vim-command.h"
-#include "gtk-source-vim-registers.h"
 
 typedef void (*Command) (GtkSourceVimCommand *self);
 
@@ -113,7 +112,6 @@ gtk_source_vim_command_join (GtkSourceVimCommand *self)
 static void
 gtk_source_vim_command_yank (GtkSourceVimCommand *self)
 {
-       GtkSourceVimState *registers;
        GtkTextIter iter;
        GtkTextIter selection;
        gboolean needs_newline = FALSE;
@@ -136,16 +134,13 @@ gtk_source_vim_command_yank (GtkSourceVimCommand *self)
                needs_newline = TRUE;
 
        text = gtk_text_iter_get_slice (&iter, &selection);
-       registers = gtk_source_vim_state_get_registers (GTK_SOURCE_VIM_STATE (self));
 
        if (needs_newline)
-               gtk_source_vim_registers_take (GTK_SOURCE_VIM_REGISTERS (registers),
-                                              NULL,
-                                              g_strdup_printf ("%s\n", text));
+               gtk_source_vim_state_set_current_register_value (GTK_SOURCE_VIM_STATE (self),
+                                                                g_strdup_printf ("%s\n", text));
        else
-               gtk_source_vim_registers_take (GTK_SOURCE_VIM_REGISTERS (registers),
-                                              NULL,
-                                              g_steal_pointer (&text));
+               gtk_source_vim_state_set_current_register_value (GTK_SOURCE_VIM_STATE (self),
+                                                                g_steal_pointer (&text));
 
        g_free (text);
 }
@@ -153,7 +148,6 @@ gtk_source_vim_command_yank (GtkSourceVimCommand *self)
 static void
 gtk_source_vim_command_paste_after (GtkSourceVimCommand *self)
 {
-       GtkSourceVimState *registers;
        GtkSourceBuffer *buffer;
        GtkTextIter iter;
        GtkTextIter selection;
@@ -161,8 +155,7 @@ gtk_source_vim_command_paste_after (GtkSourceVimCommand *self)
        int count;
 
        buffer = gtk_source_vim_state_get_buffer (GTK_SOURCE_VIM_STATE (self), &iter, &selection);
-       registers = gtk_source_vim_state_get_registers (GTK_SOURCE_VIM_STATE (self));
-       text = gtk_source_vim_registers_get (GTK_SOURCE_VIM_REGISTERS (registers), NULL);
+       text = gtk_source_vim_state_get_current_register_value (GTK_SOURCE_VIM_STATE (self));
        count = gtk_source_vim_state_get_count (GTK_SOURCE_VIM_STATE (self));
 
        if (text == NULL)
@@ -214,7 +207,6 @@ gtk_source_vim_command_paste_after (GtkSourceVimCommand *self)
 static void
 gtk_source_vim_command_paste_before (GtkSourceVimCommand *self)
 {
-       GtkSourceVimState *registers;
        GtkSourceBuffer *buffer;
        GtkTextIter iter;
        GtkTextIter selection;
@@ -222,8 +214,7 @@ gtk_source_vim_command_paste_before (GtkSourceVimCommand *self)
        int count;
 
        buffer = gtk_source_vim_state_get_buffer (GTK_SOURCE_VIM_STATE (self), &iter, &selection);
-       registers = gtk_source_vim_state_get_registers (GTK_SOURCE_VIM_STATE (self));
-       text = gtk_source_vim_registers_get (GTK_SOURCE_VIM_REGISTERS (registers), NULL);
+       text = gtk_source_vim_state_get_current_register_value (GTK_SOURCE_VIM_STATE (self));
        count = gtk_source_vim_state_get_count (GTK_SOURCE_VIM_STATE (self));
 
        if (text == NULL)


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