[gtksourceview/wip/chergert/vim: 98/293] dont allow going to line end




commit ef9859a2589b221f0ea5e2370ea85549de3c5dfe
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 27 12:55:00 2021 -0700

    dont allow going to line end

 gtksourceview/vim/gtk-source-vim-motion.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-motion.c b/gtksourceview/vim/gtk-source-vim-motion.c
index 37b73392..e5fa1db2 100644
--- a/gtksourceview/vim/gtk-source-vim-motion.c
+++ b/gtksourceview/vim/gtk-source-vim-motion.c
@@ -553,8 +553,10 @@ motion_next_line_visual_column (GtkTextIter        *iter,
        column = gtk_source_view_get_visual_column (view, iter);
 
        gtk_text_iter_set_line (iter, line + 1);
-       if (!gtk_text_iter_ends_line (iter))
-               get_iter_at_visual_column (view, iter, column);
+       get_iter_at_visual_column (view, iter, column);
+
+       if (!gtk_text_iter_starts_line (iter) && gtk_text_iter_ends_line (iter))
+               gtk_text_iter_backward_char (iter);
 
        return !gtk_text_iter_equal (&before, iter);
 }
@@ -577,6 +579,9 @@ motion_prev_line_visual_column (GtkTextIter        *iter,
 
        get_iter_at_visual_column (view, iter, column);
 
+       if (!gtk_text_iter_starts_line (iter) && gtk_text_iter_ends_line (iter))
+               gtk_text_iter_backward_char (iter);
+
        return TRUE;
 }
 


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