From cb6279c63bbb98a419f9f72495b8a8232a3e7529 Mon Sep 17 00:00:00 2001 From: Doug Freed Date: Mon, 17 Sep 2018 13:28:46 +0000 Subject: [PATCH 1/3] fe-text: add window_default_hidelevel setting Allows specifying the hidelevel that new windows get by default. --- src/fe-text/gui-windows.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c index e7f799c8..0890fe6f 100644 --- a/src/fe-text/gui-windows.c +++ b/src/fe-text/gui-windows.c @@ -53,7 +53,7 @@ static GUI_WINDOW_REC *gui_window_init(WINDOW_REC *window, get_default_indent_func()); textbuffer_view_set_break_wide(gui->view, settings_get_bool("break_wide")); wcwidth_impl = settings_get_choice("wcwidth_implementation"); - textbuffer_view_set_hidden_level(gui->view, MSGLEVEL_HIDDEN); + textbuffer_view_set_hidden_level(gui->view, settings_get_level("window_default_hidelevel")); if (parent->active == window) textbuffer_view_set_window(gui->view, parent->screen_win); return gui; @@ -303,6 +303,7 @@ void gui_windows_init(void) settings_add_bool("lookandfeel", "indent_always", FALSE); settings_add_bool("lookandfeel", "break_wide", FALSE); settings_add_bool("lookandfeel", "scroll", TRUE); + settings_add_level("lookandfeel", "window_default_hidelevel", "HIDDEN"); window_create_override = MAIN_WINDOW_TYPE_NONE; From 074e6cf768b9c153b64a916b4b2d332d8ba6bef4 Mon Sep 17 00:00:00 2001 From: Doug Freed Date: Mon, 17 Sep 2018 14:26:25 +0000 Subject: [PATCH 2/3] fe-text: only save non-default window hidelevel This will only save the window hidelevel in the layout if it differs from window_default_hidelevel. --- src/fe-text/mainwindows-layout.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fe-text/mainwindows-layout.c b/src/fe-text/mainwindows-layout.c index 17c6647b..b937dffe 100644 --- a/src/fe-text/mainwindows-layout.c +++ b/src/fe-text/mainwindows-layout.c @@ -42,7 +42,7 @@ static void sig_layout_window_save(WINDOW_REC *window, CONFIG_NODE *node) iconfig_node_set_int(node, "parent", active->refnum); } - if (gui->view->hidden_level != MSGLEVEL_HIDDEN) { + if (gui->view->hidden_level != settings_get_level("window_default_hidelevel")) { char *level = bits2level(gui->view->hidden_level); iconfig_node_set_str(node, "hidelevel", level); g_free(level); @@ -56,6 +56,7 @@ static void sig_layout_window_restore(WINDOW_REC *window, CONFIG_NODE *node) { WINDOW_REC *parent; GUI_WINDOW_REC *gui; + char *default_hidelevel = settings_get_str("window_default_hidelevel"); gui = WINDOW_GUI(window); @@ -66,7 +67,7 @@ static void sig_layout_window_restore(WINDOW_REC *window, CONFIG_NODE *node) if (config_node_get_bool(node, "sticky", FALSE)) gui_window_set_sticky(window); - textbuffer_view_set_hidden_level(gui->view, level2bits(config_node_get_str(node, "hidelevel", "HIDDEN"), NULL)); + textbuffer_view_set_hidden_level(gui->view, level2bits(config_node_get_str(node, "hidelevel", default_hidelevel), NULL)); if (config_node_get_str(node, "scroll", NULL) != NULL) { gui->use_scroll = TRUE; From cad79f1db74787c68951e166cdc68af21ec67301 Mon Sep 17 00:00:00 2001 From: Doug Freed Date: Mon, 17 Sep 2018 14:34:06 +0000 Subject: [PATCH 3/3] Fix compilation warning --- src/fe-text/mainwindows-layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-text/mainwindows-layout.c b/src/fe-text/mainwindows-layout.c index b937dffe..b3f8e741 100644 --- a/src/fe-text/mainwindows-layout.c +++ b/src/fe-text/mainwindows-layout.c @@ -56,7 +56,7 @@ static void sig_layout_window_restore(WINDOW_REC *window, CONFIG_NODE *node) { WINDOW_REC *parent; GUI_WINDOW_REC *gui; - char *default_hidelevel = settings_get_str("window_default_hidelevel"); + const char *default_hidelevel = settings_get_str("window_default_hidelevel"); gui = WINDOW_GUI(window);