[gtksourceview/wip/chergert/vim: 240/293] stash visible column in normal mode




commit c065a6a65eeac4830d0de56e20fb2a5811bbba10
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 2 19:53:43 2021 -0700

    stash visible column in normal mode

 gtksourceview/vim/gtk-source-vim-normal.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-normal.c b/gtksourceview/vim/gtk-source-vim-normal.c
index beda6708..0ffedf41 100644
--- a/gtksourceview/vim/gtk-source-vim-normal.c
+++ b/gtksourceview/vim/gtk-source-vim-normal.c
@@ -21,6 +21,8 @@
 
 #include "config.h"
 
+#include "gtksourceview.h"
+
 #include "gtk-source-vim.h"
 #include "gtk-source-vim-char-pending.h"
 #include "gtk-source-vim-command.h"
@@ -1079,6 +1081,17 @@ gtk_source_vim_normal_resume (GtkSourceVimState *state,
                g_set_object (&self->last_visual, from);
        }
 
+       if (!GTK_SOURCE_IS_VIM_MOTION (from) ||
+           gtk_source_vim_motion_invalidates_visual_column (GTK_SOURCE_VIM_MOTION (from)))
+       {
+               GtkTextIter iter;
+               guint visual_column;
+
+               gtk_source_vim_state_get_buffer (state, &iter, NULL);
+               visual_column = gtk_source_view_get_visual_column (view, &iter);
+               gtk_source_vim_state_set_visual_column (state, visual_column);
+       }
+
        /* If we're still on the \n, go back a char */
        keep_on_char (self);
 


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