[gtksourceview/wip/chergert/vim: 65/293] fix j motion




commit 396cc1a4081e45775890288ce40d98eb77da687c
Author: Christian Hergert <chergert redhat com>
Date:   Sun Oct 24 13:24:04 2021 -0700

    fix j motion

 gtksourceview/vim/gtk-source-vim-motion.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-motion.c b/gtksourceview/vim/gtk-source-vim-motion.c
index ca2bdbb3..bd19ff12 100644
--- a/gtksourceview/vim/gtk-source-vim-motion.c
+++ b/gtksourceview/vim/gtk-source-vim-motion.c
@@ -513,6 +513,8 @@ motion_next_line_visual_column (GtkTextIter        *iter,
                                 GtkSourceVimMotion *state)
 {
        GtkSourceView *view = gtk_source_vim_state_get_view (GTK_SOURCE_VIM_STATE (state));
+       GtkTextIter before = *iter;
+       guint line = gtk_text_iter_get_line (iter);
        guint column;
 
        /* TODO: We need a way to persist the visual column across
@@ -521,12 +523,11 @@ motion_next_line_visual_column (GtkTextIter        *iter,
         */
        column = gtk_source_view_get_visual_column (view, iter);
 
-       if (!motion_next_line (iter, state))
-               return FALSE;
-
-       get_iter_at_visual_column (view, iter, column);
+       gtk_text_iter_set_line (iter, line + 1);
+       if (!gtk_text_iter_ends_line (iter))
+               get_iter_at_visual_column (view, iter, column);
 
-       return TRUE;
+       return !gtk_text_iter_equal (&before, iter);
 }
 
 static gboolean


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