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




commit c2b87544929b8dfcd57d7216e6b9c0e87c88d22a
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]