[gtksourceview/wip/chergert/vim] fix j motion
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim] fix j motion
- Date: Mon, 25 Oct 2021 02:23:53 +0000 (UTC)
commit 7d7b67599f681b080b13a2af37cc3a77d5169462
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]