diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-15 04:58:51 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-15 05:09:42 +0100 |
commit | 9333081178b825f89d81277b57ed2971039f0ce0 (patch) | |
tree | 35f443849767ab5493b79150d20201b68a988cdf /degesch.c | |
parent | b7c9e8ca23dee372ddf8ad5d1e845950ec15a2e2 (diff) | |
download | xK-9333081178b825f89d81277b57ed2971039f0ce0.tar.gz xK-9333081178b825f89d81277b57ed2971039f0ce0.tar.xz xK-9333081178b825f89d81277b57ed2971039f0ce0.zip |
degesch: option for fullscreen buffers
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 37 |
1 files changed, 31 insertions, 6 deletions
@@ -1514,6 +1514,7 @@ struct app_context char *attrs[ATTR_COUNT]; ///< Terminal attributes bool isolate_buffers; ///< Isolate global/server buffers bool beep_on_highlight; ///< Beep on highlight + bool fullscreen_buffers; ///< Buffers take the whole screen bool logging; ///< Logging to file enabled bool show_all_prefixes; ///< Show all prefixes before nicks @@ -1714,6 +1715,7 @@ static void on_config_logging_change (struct config_item *item); } TRIVIAL_BOOLEAN_ON_CHANGE (isolate_buffers) +TRIVIAL_BOOLEAN_ON_CHANGE (fullscreen_buffers) TRIVIAL_BOOLEAN_ON_CHANGE (beep_on_highlight) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1874,6 +1876,11 @@ static struct config_schema g_config_behaviour[] = .type = CONFIG_ITEM_BOOLEAN, .default_ = "off", .on_change = on_config_isolate_buffers_change }, + { .name = "fullscreen_buffers", + .comment = "Space above buffer contents is filled with whitespace", + .type = CONFIG_ITEM_BOOLEAN, + .default_ = "off", + .on_change = on_config_fullscreen_buffers_change }, { .name = "beep_on_highlight", .comment = "Beep when highlighted or on a new invisible PM", .type = CONFIG_ITEM_BOOLEAN, @@ -3402,13 +3409,31 @@ buffer_print_backlog (struct app_context *ctx, struct buffer *buffer) // The prompt can take considerable time to redraw input_hide (&ctx->input); - char *buffer_name_localized = - iconv_xstrdup (ctx->term_from_utf8, buffer->name, -1, NULL); - print_status ("%s", buffer_name_localized); - free (buffer_name_localized); + // That is, minus the readline prompt + int display_limit = MAX (10, g_terminal.lines - 1); - // That is, minus the buffer switch line and the readline prompt - int display_limit = MAX (10, g_terminal.lines - 2); + terminal_printer_fn printer = get_attribute_printer (stdout); + if (ctx->fullscreen_buffers) + { + if (soft_assert (clear_screen)) + tputs (clear_screen, 1, printer); + if (cursor_to_ll) + tputs (cursor_to_ll, 1, printer); + else if (row_address) + tputs (tparm (row_address, g_terminal.lines - 1, + 0, 0, 0, 0, 0, 0, 0, 0), 1, printer); + else if (cursor_address) + tputs (tparm (cursor_address, g_terminal.lines - 1, + 0, 0, 0, 0, 0, 0, 0, 0), 1, printer); + } + else + { + char *buffer_name_localized = + iconv_xstrdup (ctx->term_from_utf8, buffer->name, -1, NULL); + print_status ("%s", buffer_name_localized); + free (buffer_name_localized); + display_limit--; + } struct buffer_line *line = buffer->lines_tail; int to_display = line != NULL; |