[gtksourceview/wip/chergert/vim: 280/293] place cursor properly for (un)indent




commit 62beffba26b9ec6ca5a20a6e9643d5b3ba1f9674
Author: Christian Hergert <chergert redhat com>
Date:   Wed Nov 3 17:14:03 2021 -0700

    place cursor properly for (un)indent

 gtksourceview/vim/gtk-source-vim-command.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-command.c b/gtksourceview/vim/gtk-source-vim-command.c
index 232a9143..4d0c9819 100644
--- a/gtksourceview/vim/gtk-source-vim-command.c
+++ b/gtksourceview/vim/gtk-source-vim-command.c
@@ -92,6 +92,15 @@ gtk_source_vim_command_shift (GtkSourceVimCommand *self,
        }
 
        gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (buffer));
+
+       gtk_text_iter_set_line_offset (&iter, 0);
+       while (!gtk_text_iter_ends_line (&iter) &&
+              g_unichar_isspace (gtk_text_iter_get_char (&iter)))
+               gtk_text_iter_forward_char (&iter);
+
+       gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer), &iter, &iter);
+
+       self->ignore_mark = TRUE;
 }
 
 static void


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