[gtksourceview/wip/chergert/vim: 40/73] set overwrite state on enter/restore
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim: 40/73] set overwrite state on enter/restore
- Date: Tue, 26 Oct 2021 23:20:37 +0000 (UTC)
commit 33a4c211bc61dfddafd6b1fd0ee8434a468210c3
Author: Christian Hergert <chergert redhat com>
Date: Fri Oct 22 11:29:30 2021 -0700
set overwrite state on enter/restore
gtksourceview/vim/gtk-source-vim-insert.c | 11 +++++++++++
gtksourceview/vim/gtk-source-vim-normal.c | 11 ++++++-----
gtksourceview/vim/gtk-source-vim-replace.c | 20 ++++++++++++++++++++
3 files changed, 37 insertions(+), 5 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-insert.c b/gtksourceview/vim/gtk-source-vim-insert.c
index cdc657dd..1da2ba18 100644
--- a/gtksourceview/vim/gtk-source-vim-insert.c
+++ b/gtksourceview/vim/gtk-source-vim-insert.c
@@ -145,6 +145,16 @@ gtk_source_vim_insert_restore (GtkSourceVimState *state,
*/
gtk_source_vim_state_pop (state);
}
+
+ gtk_source_vim_state_set_overwrite (state, FALSE);
+}
+
+static void
+gtk_source_vim_insert_enter (GtkSourceVimState *state)
+{
+ g_assert (GTK_SOURCE_IS_VIM_INSERT (state));
+
+ gtk_source_vim_state_set_overwrite (state, FALSE);
}
static void
@@ -163,6 +173,7 @@ gtk_source_vim_insert_class_init (GtkSourceVimInsertClass *klass)
state_class->handle_event = gtk_source_vim_insert_handle_event;
state_class->restore = gtk_source_vim_insert_restore;
+ state_class->enter = gtk_source_vim_insert_enter;
}
static void
diff --git a/gtksourceview/vim/gtk-source-vim-normal.c b/gtksourceview/vim/gtk-source-vim-normal.c
index db1010af..eee71207 100644
--- a/gtksourceview/vim/gtk-source-vim-normal.c
+++ b/gtksourceview/vim/gtk-source-vim-normal.c
@@ -531,23 +531,24 @@ gtk_source_vim_normal_restore (GtkSourceVimState *state,
}
}
+ gtk_source_vim_state_set_overwrite (state, TRUE);
}
static void
-gtk_source_vim_normal_finalize (GObject *object)
+gtk_source_vim_normal_enter (GtkSourceVimState *state)
{
- G_OBJECT_CLASS (gtk_source_vim_normal_parent_class)->finalize (object);
+ g_assert (GTK_SOURCE_IS_VIM_NORMAL (state));
+
+ gtk_source_vim_state_set_overwrite (state, TRUE);
}
static void
gtk_source_vim_normal_class_init (GtkSourceVimNormalClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkSourceVimStateClass *state_class = GTK_SOURCE_VIM_STATE_CLASS (klass);
- object_class->finalize = gtk_source_vim_normal_finalize;
-
state_class->handle_keypress = gtk_source_vim_normal_handle_keypress;
+ state_class->enter = gtk_source_vim_normal_enter;
state_class->restore = gtk_source_vim_normal_restore;
}
diff --git a/gtksourceview/vim/gtk-source-vim-replace.c b/gtksourceview/vim/gtk-source-vim-replace.c
index 8f077cc6..1c2dea3e 100644
--- a/gtksourceview/vim/gtk-source-vim-replace.c
+++ b/gtksourceview/vim/gtk-source-vim-replace.c
@@ -88,12 +88,32 @@ gtk_source_vim_replace_handle_keypress (GtkSourceVimState *state,
return FALSE;
}
+static void
+gtk_source_vim_replace_enter (GtkSourceVimState *state)
+{
+ g_assert (GTK_SOURCE_IS_VIM_REPLACE (state));
+
+ gtk_source_vim_state_set_overwrite (state, TRUE);
+}
+
+static void
+gtk_source_vim_replace_restore (GtkSourceVimState *state,
+ GtkSourceVimState *from)
+{
+ g_assert (GTK_SOURCE_IS_VIM_REPLACE (state));
+ g_assert (GTK_SOURCE_IS_VIM_REPLACE (from));
+
+ gtk_source_vim_state_set_overwrite (state, TRUE);
+}
+
static void
gtk_source_vim_replace_class_init (GtkSourceVimReplaceClass *klass)
{
GtkSourceVimStateClass *state_class = GTK_SOURCE_VIM_STATE_CLASS (klass);
state_class->handle_keypress = gtk_source_vim_replace_handle_keypress;
+ state_class->enter = gtk_source_vim_replace_enter;
+ state_class->restore = gtk_source_vim_replace_restore;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]