[gtksourceview/wip/chergert/vim] create new mark for new visual
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim] create new mark for new visual
- Date: Sat, 30 Oct 2021 22:58:01 +0000 (UTC)
commit 8aa999c51b9a518b866c131c20c2e26c0d6ec088
Author: Christian Hergert <chergert redhat com>
Date: Sat Oct 30 15:57:06 2021 -0700
create new mark for new visual
that way we don't race on dispose
gtksourceview/vim/gtk-source-vim-visual.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-visual.c b/gtksourceview/vim/gtk-source-vim-visual.c
index 90f540f3..fdd9ace5 100644
--- a/gtksourceview/vim/gtk-source-vim-visual.c
+++ b/gtksourceview/vim/gtk-source-vim-visual.c
@@ -376,12 +376,24 @@ GtkSourceVimState *
gtk_source_vim_visual_clone (GtkSourceVimVisual *self)
{
GtkSourceVimState *ret;
+ GtkTextIter cursor;
+ GtkTextIter started_at;
g_return_val_if_fail (GTK_SOURCE_IS_VIM_VISUAL (self), NULL);
ret = gtk_source_vim_visual_new (self->mode);
- g_set_weak_pointer (>K_SOURCE_VIM_VISUAL (ret)->cursor, self->cursor);
- g_set_weak_pointer (>K_SOURCE_VIM_VISUAL (ret)->started_at, self->started_at);
+
+ if (gtk_source_vim_visual_get_bounds (self, &cursor, &started_at))
+ {
+ GtkSourceBuffer *buffer = gtk_source_vim_state_get_buffer (GTK_SOURCE_VIM_STATE (self), NULL,
NULL);
+ GtkTextMark *mark;
+
+ mark = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (buffer), NULL, &cursor, FALSE);
+ g_set_weak_pointer (>K_SOURCE_VIM_VISUAL (ret)->cursor, mark);
+
+ mark = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (buffer), NULL, &started_at, TRUE);
+ g_set_weak_pointer (>K_SOURCE_VIM_VISUAL (ret)->started_at, mark);
+ }
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]