[gtksourceview/wip/chergert/vim: 34/73] overwrite character when in replace mode




commit 4a8dbeccf2941b840805f51f35ca3ca5b27044a8
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 22 11:01:23 2021 -0700

    overwrite character when in replace mode
    
    still need to fix how we remove overwrite mode for insert mode while
    retaining the block cursor.

 gtksourceview/vim/gtk-source-vim-insert-literal.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-insert-literal.c 
b/gtksourceview/vim/gtk-source-vim-insert-literal.c
index 893c80eb..87ff40af 100644
--- a/gtksourceview/vim/gtk-source-vim-insert-literal.c
+++ b/gtksourceview/vim/gtk-source-vim-insert-literal.c
@@ -46,9 +46,22 @@ do_literal (GtkSourceVimInsertLiteral *self,
        if (string[0] != 0)
        {
                GtkSourceBuffer *buffer;
+               GtkSourceView *view;
                GtkTextIter insert;
 
+               view = gtk_source_vim_state_get_view (GTK_SOURCE_VIM_STATE (self));
                buffer = gtk_source_vim_state_get_buffer (GTK_SOURCE_VIM_STATE (self), &insert, NULL);
+
+               if (gtk_text_view_get_overwrite (GTK_TEXT_VIEW (view)))
+               {
+                       GtkTextIter end = insert;
+
+                       if (gtk_text_iter_forward_char (&end))
+                       {
+                               gtk_text_buffer_delete (GTK_TEXT_BUFFER (buffer), &insert, &end);
+                       }
+               }
+
                gtk_text_buffer_insert (GTK_TEXT_BUFFER (buffer), &insert, string, -1);
        }
 


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