[gtksourceview/wip/chergert/vim: 255/363] walk upwards to find a command bar text if any




commit 2343d05a8e995eccbd4a73d9026e11f5fff8edcf
Author: Christian Hergert <chergert redhat com>
Date:   Wed Nov 3 15:38:01 2021 -0700

    walk upwards to find a command bar text if any

 gtksourceview/vim/gtk-source-vim.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim.c b/gtksourceview/vim/gtk-source-vim.c
index 9a8f5276..6c7f3634 100644
--- a/gtksourceview/vim/gtk-source-vim.c
+++ b/gtksourceview/vim/gtk-source-vim.c
@@ -256,19 +256,24 @@ gtk_source_vim_get_command_bar_text (GtkSourceVim *self)
 
        current = gtk_source_vim_state_get_current (GTK_SOURCE_VIM_STATE (self));
 
-       if (GTK_SOURCE_IS_VIM_COMMAND_BAR (current))
+       while (current != NULL)
        {
-               return gtk_source_vim_command_bar_get_text (GTK_SOURCE_VIM_COMMAND_BAR (current));
-       }
-
-       if (GTK_SOURCE_VIM_STATE_GET_CLASS (current)->get_command_bar_text)
-       {
-               return GTK_SOURCE_VIM_STATE_GET_CLASS (current)->get_command_bar_text (current);
-       }
-
-       if (GTK_SOURCE_VIM_STATE_GET_CLASS (current)->command_bar_text)
-       {
-               return GTK_SOURCE_VIM_STATE_GET_CLASS (current)->command_bar_text;
+               if (GTK_SOURCE_IS_VIM_COMMAND_BAR (current))
+               {
+                       return gtk_source_vim_command_bar_get_text (GTK_SOURCE_VIM_COMMAND_BAR (current));
+               }
+
+               if (GTK_SOURCE_VIM_STATE_GET_CLASS (current)->get_command_bar_text)
+               {
+                       return GTK_SOURCE_VIM_STATE_GET_CLASS (current)->get_command_bar_text (current);
+               }
+
+               if (GTK_SOURCE_VIM_STATE_GET_CLASS (current)->command_bar_text)
+               {
+                       return GTK_SOURCE_VIM_STATE_GET_CLASS (current)->command_bar_text;
+               }
+
+               current = gtk_source_vim_state_get_parent (current);
        }
 
        return "";


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