summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fe-text/gui-readline.c16
-rw-r--r--src/fe-text/statusbar-config.c1
-rw-r--r--src/fe-text/statusbar-items.c5
-rw-r--r--src/fe-text/statusbar.c9
4 files changed, 22 insertions, 9 deletions
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c
index 4d71e195..84fba1a9 100644
--- a/src/fe-text/gui-readline.c
+++ b/src/fe-text/gui-readline.c
@@ -145,29 +145,29 @@ void handle_key(int key)
static void key_send_line(void)
{
- int add_history;
- char *str;
+ char *str, *add_history;
str = gui_entry_get_text(active_entry);
if (*str == '\0') return;
+ /* we can't use gui_entry_get_text() later, since the entry might
+ have been destroyed after we get back */
+ add_history = g_strdup(str);
translate_output(str);
- add_history = TRUE;
if (redir == NULL) {
signal_emit("send command", 3, str,
active_win->active_server,
active_win->active);
} else {
if (redir->flags & ENTRY_REDIRECT_FLAG_HIDDEN)
- add_history = FALSE;
+ g_free_and_null(add_history);
handle_entry_redirect(str);
}
- if (add_history) {
- command_history_add(active_win, gui_entry_get_text(active_entry),
- FALSE);
- }
+ if (add_history != NULL)
+ command_history_add(active_win, add_history, FALSE);
+
gui_entry_set_text(active_entry, "");
command_history_clear_pos(active_win);
}
diff --git a/src/fe-text/statusbar-config.c b/src/fe-text/statusbar-config.c
index cc14b886..f703afa7 100644
--- a/src/fe-text/statusbar-config.c
+++ b/src/fe-text/statusbar-config.c
@@ -260,4 +260,5 @@ void statusbar_config_init(void)
void statusbar_config_deinit(void)
{
+ signal_remove("setup reread", (SIGNAL_FUNC) read_statusbar_config);
}
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index ee33dafa..3cb496c9 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -290,7 +290,10 @@ static void sig_statusbar_item_destroyed(SBAR_ITEM_REC *item)
GUI_ENTRY_REC *rec;
rec = g_hash_table_lookup(input_entries, item);
- if (rec != NULL) gui_entry_destroy(rec);
+ if (rec != NULL) {
+ gui_entry_destroy(rec);
+ g_hash_table_remove(input_entries, item);
+ }
}
}
diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c
index aa8b35b4..affbf13e 100644
--- a/src/fe-text/statusbar.c
+++ b/src/fe-text/statusbar.c
@@ -921,6 +921,13 @@ static void statusbar_item_signal_destroy(void *key, GSList *value)
g_slist_free(value);
}
+static void sig_setup_reload(void)
+{
+ /* statusbar-config.c recreates root statusbars,
+ we need to create window-statusbars */
+ g_slist_foreach(mainwindows, (GFunc) statusbars_add_visible, NULL);
+}
+
void statusbar_init(void)
{
statusbar_groups = NULL;
@@ -942,6 +949,7 @@ void statusbar_init(void)
signal_add("mainwindow moved", (SIGNAL_FUNC) sig_mainwindow_resized);
signal_add("window changed", (SIGNAL_FUNC) sig_window_changed);
signal_add("mainwindow destroyed", (SIGNAL_FUNC) sig_mainwindow_destroyed);
+ signal_add_last("setup reread", (SIGNAL_FUNC) sig_setup_reload);
}
void statusbar_deinit(void)
@@ -968,6 +976,7 @@ void statusbar_deinit(void)
signal_remove("mainwindow moved", (SIGNAL_FUNC) sig_mainwindow_resized);
signal_remove("window changed", (SIGNAL_FUNC) sig_window_changed);
signal_remove("mainwindow destroyed", (SIGNAL_FUNC) sig_mainwindow_destroyed);
+ signal_remove("setup reread", (SIGNAL_FUNC) sig_setup_reload);
statusbar_items_deinit();
statusbar_config_deinit();