[gtksourceview/wip/chergert/vim] dont allow setting readonly register from vim state



commit 738fb9eb6e6ccfa6fae870cbcf61477b1a6d51ca
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 2 12:57:01 2021 -0700

    dont allow setting readonly register from vim state
    
    you have to access the registers object directly to do that (like the
    text history does).

 gtksourceview/vim/gtk-source-vim-state.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-state.c b/gtksourceview/vim/gtk-source-vim-state.c
index f44c27e1..e39b1870 100644
--- a/gtksourceview/vim/gtk-source-vim-state.c
+++ b/gtksourceview/vim/gtk-source-vim-state.c
@@ -1008,5 +1008,10 @@ gtk_source_vim_state_set_current_register_value (GtkSourceVimState *self,
        current_register = gtk_source_vim_state_get_current_register (self);
        registers = gtk_source_vim_state_get_registers (self);
 
-       gtk_source_vim_registers_set (GTK_SOURCE_VIM_REGISTERS (registers), current_register, value);
+       if (!gtk_source_vim_register_is_read_only (current_register))
+       {
+               gtk_source_vim_registers_set (GTK_SOURCE_VIM_REGISTERS (registers),
+                                             current_register,
+                                             value);
+       }
 }


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