[gtksourceview/wip/chergert/vim] more mark tweaks



commit f448ce7b8e57a077daf2a672db92efc469dabbf3
Author: Christian Hergert <chergert redhat com>
Date:   Sun Nov 7 11:51:24 2021 -0800

    more mark tweaks

 gtksourceview/vim/gtk-source-vim-marks.c  | 6 +++++-
 gtksourceview/vim/gtk-source-vim-motion.c | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-marks.c b/gtksourceview/vim/gtk-source-vim-marks.c
index 183b7eff..3721b43b 100644
--- a/gtksourceview/vim/gtk-source-vim-marks.c
+++ b/gtksourceview/vim/gtk-source-vim-marks.c
@@ -87,7 +87,11 @@ gtk_source_vim_marks_get_mark (GtkSourceVimMarks *self,
 
                buffer = gtk_source_vim_state_get_buffer (GTK_SOURCE_VIM_STATE (self), &iter, &selection);
 
-               if (gtk_text_iter_compare (&iter, &selection) < 0)
+               if (gtk_text_iter_equal (&iter, &selection))
+               {
+                       return gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (buffer));
+               }
+               else if (gtk_text_iter_compare (&iter, &selection) < 0)
                {
                        if (name[0] == '<')
                                return gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (buffer));
diff --git a/gtksourceview/vim/gtk-source-vim-motion.c b/gtksourceview/vim/gtk-source-vim-motion.c
index debec06d..2e1bf6d0 100644
--- a/gtksourceview/vim/gtk-source-vim-motion.c
+++ b/gtksourceview/vim/gtk-source-vim-motion.c
@@ -1664,7 +1664,10 @@ gtk_source_vim_motion_handle_keypress (GtkSourceVimState *state,
 
        if (self->mark_linewise || self->mark_charwise)
        {
-               if (!g_ascii_isalpha (string[0]))
+               GtkTextIter iter;
+
+               /* Make sure we found the mark */
+               if (!gtk_source_vim_state_get_iter_at_mark (state, string, &iter))
                        return gtk_source_vim_motion_bail (self);
 
                self->f_char = string[0];


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