[gtksourceview/wip/chergert/vim] add empty check helper



commit df41bcb3b560b72552376155ca00b55628d703ef
Author: Christian Hergert <chergert redhat com>
Date:   Fri Nov 5 16:40:52 2021 -0700

    add empty check helper

 gtksourceview/vim/gtk-source-vim-text-history.c | 8 ++++++++
 gtksourceview/vim/gtk-source-vim-text-history.h | 9 +++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-text-history.c b/gtksourceview/vim/gtk-source-vim-text-history.c
index 89600b7e..883270ce 100644
--- a/gtksourceview/vim/gtk-source-vim-text-history.c
+++ b/gtksourceview/vim/gtk-source-vim-text-history.c
@@ -334,3 +334,11 @@ gtk_source_vim_text_history_replay (GtkSourceVimTextHistory *self)
                }
        }
 }
+
+gboolean
+gtk_source_vim_text_history_is_empty (GtkSourceVimTextHistory *self)
+{
+       g_return_val_if_fail (GTK_SOURCE_IS_VIM_TEXT_HISTORY (self), FALSE);
+
+       return self->ops->len == 0;
+}
diff --git a/gtksourceview/vim/gtk-source-vim-text-history.h b/gtksourceview/vim/gtk-source-vim-text-history.h
index e64db007..6774cc08 100644
--- a/gtksourceview/vim/gtk-source-vim-text-history.h
+++ b/gtksourceview/vim/gtk-source-vim-text-history.h
@@ -29,9 +29,10 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (GtkSourceVimTextHistory, gtk_source_vim_text_history, GTK_SOURCE, VIM_TEXT_HISTORY, 
GtkSourceVimState)
 
-GtkSourceVimState *gtk_source_vim_text_history_new    (void);
-void               gtk_source_vim_text_history_replay (GtkSourceVimTextHistory *self);
-void               gtk_source_vim_text_history_begin  (GtkSourceVimTextHistory *self);
-void               gtk_source_vim_text_history_end    (GtkSourceVimTextHistory *self);
+GtkSourceVimState *gtk_source_vim_text_history_new      (void);
+void               gtk_source_vim_text_history_replay   (GtkSourceVimTextHistory *self);
+void               gtk_source_vim_text_history_begin    (GtkSourceVimTextHistory *self);
+void               gtk_source_vim_text_history_end      (GtkSourceVimTextHistory *self);
+gboolean           gtk_source_vim_text_history_is_empty (GtkSourceVimTextHistory *self);
 
 G_END_DECLS


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