about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-10-18 23:16:19 +0100
committerJames Booth <boothj5@gmail.com>2014-10-18 23:16:19 +0100
commit6246c8b94074d0fa28aa36d4412b834c8657b819 (patch)
tree719cf91d450d11994c62fe5e227363d1eab7abaf /src/ui
parentbd03bbad730a7b5f2a935dcda3f7b06184cb72d7 (diff)
downloadprofani-tty-6246c8b94074d0fa28aa36d4412b834c8657b819.tar.gz
Add fields to command autocompleter on switch/previous/next
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/core.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 899cc3fb..837cac3d 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -726,7 +726,16 @@ static gboolean
 _ui_switch_win(const int i)
 {
     if (ui_win_exists(i)) {
+        ProfWin *old_current = wins_get_current();
+        if (old_current->type == WIN_MUC_CONFIG) {
+            cmd_autocomplete_remove_form_fields(old_current->form);
+        }
+
         ProfWin *new_current = wins_get_by_num(i);
+        if (new_current->type == WIN_MUC_CONFIG) {
+            cmd_autocomplete_add_form_fields(new_current->form);
+        }
+
         wins_set_current_by_num(i);
 
         new_current->unread = 0;
@@ -751,7 +760,16 @@ _ui_switch_win(const int i)
 static void
 _ui_previous_win(void)
 {
+    ProfWin *old_current = wins_get_current();
+    if (old_current->type == WIN_MUC_CONFIG) {
+        cmd_autocomplete_remove_form_fields(old_current->form);
+    }
+
     ProfWin *new_current = wins_get_previous();
+    if (new_current->type == WIN_MUC_CONFIG) {
+        cmd_autocomplete_add_form_fields(new_current->form);
+    }
+
     int i = wins_get_num(new_current);
     wins_set_current_by_num(i);
 
@@ -773,7 +791,16 @@ _ui_previous_win(void)
 static void
 _ui_next_win(void)
 {
+    ProfWin *old_current = wins_get_current();
+    if (old_current->type == WIN_MUC_CONFIG) {
+        cmd_autocomplete_remove_form_fields(old_current->form);
+    }
+
     ProfWin *new_current = wins_get_next();
+    if (new_current->type == WIN_MUC_CONFIG) {
+        cmd_autocomplete_add_form_fields(new_current->form);
+    }
+
     int i = wins_get_num(new_current);
     wins_set_current_by_num(i);