[gtksourceview/wip/chergert/vim] <> are special marks names



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

    <> are special marks names

 gtksourceview/vim/gtk-source-vim-marks.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-marks.c b/gtksourceview/vim/gtk-source-vim-marks.c
index 6ec33cf9..183b7eff 100644
--- a/gtksourceview/vim/gtk-source-vim-marks.c
+++ b/gtksourceview/vim/gtk-source-vim-marks.c
@@ -80,6 +80,29 @@ gtk_source_vim_marks_get_mark (GtkSourceVimMarks *self,
        g_return_val_if_fail (GTK_SOURCE_IS_VIM_MARKS (self), NULL);
        g_return_val_if_fail (name != NULL, NULL);
 
+       if (name[0] == '<' || name[1] == '>')
+       {
+               GtkTextIter iter, selection;
+               GtkSourceBuffer *buffer;
+
+               buffer = gtk_source_vim_state_get_buffer (GTK_SOURCE_VIM_STATE (self), &iter, &selection);
+
+               if (gtk_text_iter_compare (&iter, &selection) < 0)
+               {
+                       if (name[0] == '<')
+                               return gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (buffer));
+                       else
+                               return gtk_text_buffer_get_selection_bound (GTK_TEXT_BUFFER (buffer));
+               }
+               else
+               {
+                       if (name[0] == '<')
+                               return gtk_text_buffer_get_selection_bound (GTK_TEXT_BUFFER (buffer));
+                       else
+                               return gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (buffer));
+               }
+       }
+
        return g_hash_table_lookup (self->marks, name);
 }
 


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