[gtksourceview/wip/chergert/vim] only auto indent if turned on



commit e04f2f6b8991580bda526791688604808f534329
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 27 21:45:58 2021 -0700

    only auto indent if turned on

 gtksourceview/vim/gtk-source-vim-insert.c | 2 +-
 tests/test-vim.c                          | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-insert.c b/gtksourceview/vim/gtk-source-vim-insert.c
index e7f84473..6da3a420 100644
--- a/gtksourceview/vim/gtk-source-vim-insert.c
+++ b/gtksourceview/vim/gtk-source-vim-insert.c
@@ -235,7 +235,7 @@ gtk_source_vim_insert_prepare (GtkSourceVimInsert *self)
                gtk_source_vim_state_select (GTK_SOURCE_VIM_STATE (self), &iter, &iter);
        }
 
-       if (self->indent)
+       if (self->indent && gtk_source_view_get_auto_indent (view))
        {
                GtkSourceIndenter *indenter = gtk_source_view_get_indenter (view);
 
diff --git a/tests/test-vim.c b/tests/test-vim.c
index 009be85a..e5d86715 100644
--- a/tests/test-vim.c
+++ b/tests/test-vim.c
@@ -110,6 +110,7 @@ main (int argc,
        gtk_source_buffer_set_language (buffer, gtk_source_language_manager_get_language (languages, "c"));
        gtk_source_buffer_set_style_scheme (buffer, gtk_source_style_scheme_manager_get_scheme (schemes, 
"Adwaita"));
        view = g_object_new (GTK_SOURCE_TYPE_VIEW,
+                            "auto-indent", TRUE,
                             "buffer", buffer,
                             "monospace", TRUE,
                             "show-line-numbers", TRUE,


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