[gtksourceview] vim: add API to reset registers
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] vim: add API to reset registers
- Date: Wed, 18 May 2022 10:45:01 +0000 (UTC)
commit 2208eb06a80bcf1d320c0a77901a30d1b279ba25
Author: Christian Hergert <chergert redhat com>
Date: Wed May 18 03:42:21 2022 -0700
vim: add API to reset registers
We want to use this internally with tests.
gtksourceview/vim/gtksourcevimregisters.c | 17 +++++++++++++++++
gtksourceview/vim/gtksourcevimregisters.h | 1 +
2 files changed, 18 insertions(+)
---
diff --git a/gtksourceview/vim/gtksourcevimregisters.c b/gtksourceview/vim/gtksourcevimregisters.c
index 58c08981..c6d664ce 100644
--- a/gtksourceview/vim/gtksourcevimregisters.c
+++ b/gtksourceview/vim/gtksourcevimregisters.c
@@ -323,3 +323,20 @@ gtk_source_vim_register_is_read_only (const char *name)
return FALSE;
}
}
+
+void
+gtk_source_vim_registers_reset (GtkSourceVimRegisters *self)
+{
+ g_return_if_fail (GTK_SOURCE_IS_VIM_REGISTERS (self));
+
+ g_hash_table_remove_all (self->values);
+ g_clear_pointer (&self->clipboard, g_ref_string_release);
+ g_clear_pointer (&self->primary_clipboard, g_ref_string_release);
+
+ for (guint i = 0; i < G_N_ELEMENTS (self->numbered); i++)
+ {
+ self->numbered[i] = NULL;
+ }
+
+ self->numbered_pos = 0;
+}
diff --git a/gtksourceview/vim/gtksourcevimregisters.h b/gtksourceview/vim/gtksourcevimregisters.h
index 94f5bb40..c27604a3 100644
--- a/gtksourceview/vim/gtksourcevimregisters.h
+++ b/gtksourceview/vim/gtksourcevimregisters.h
@@ -37,6 +37,7 @@ const char *gtk_source_vim_registers_get_numbered (GtkSourceVimRegisters
void gtk_source_vim_registers_set (GtkSourceVimRegisters *self,
const char *name,
const char *string);
+void gtk_source_vim_registers_reset (GtkSourceVimRegisters *self);
void gtk_source_vim_registers_clear (GtkSourceVimRegisters *self,
const char *name);
gboolean gtk_source_vim_register_is_read_only (const char *name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]