degesch: cleanup, fix no-tty mode FWIW
Removed the no color mode that couldn't even be enabled. Not sure why we still support running without a proper terminal but let's at least not make it crash for now.
This commit is contained in:
parent
e11ca7cc00
commit
1c9de9291b
10
degesch.c
10
degesch.c
@ -1927,7 +1927,6 @@ struct completion_hook_vtable
|
||||
|
||||
struct app_context
|
||||
{
|
||||
bool no_colors; ///< Disable attribute printing
|
||||
char *attrs_defaults[ATTR_COUNT]; ///< Default terminal attributes
|
||||
|
||||
// Configuration:
|
||||
@ -2620,16 +2619,17 @@ init_colors (struct app_context *ctx)
|
||||
INIT_ATTR (JOIN, g_terminal.color_set_fg[COLOR_GREEN]);
|
||||
INIT_ATTR (PART, g_terminal.color_set_fg[COLOR_RED]);
|
||||
|
||||
char *highlight = xstrdup_printf ("%s%s%s",
|
||||
char *highlight = have_ti ? xstrdup_printf ("%s%s%s",
|
||||
g_terminal.color_set_fg[COLOR_YELLOW],
|
||||
g_terminal.color_set_bg[COLOR_MAGENTA],
|
||||
enter_bold_mode);
|
||||
enter_bold_mode) : NULL;
|
||||
INIT_ATTR (HIGHLIGHT, highlight);
|
||||
free (highlight);
|
||||
|
||||
#undef INIT_ATTR
|
||||
|
||||
if (ctx->no_colors)
|
||||
// This prevents formatters from obtaining an attribute printer function
|
||||
if (!have_ti)
|
||||
{
|
||||
g_terminal.stdout_is_tty = false;
|
||||
g_terminal.stderr_is_tty = false;
|
||||
@ -3749,7 +3749,7 @@ buffer_print_backlog (struct app_context *ctx, struct buffer *buffer)
|
||||
int display_limit = MAX (10, g_terminal.lines - 1);
|
||||
|
||||
// Simulate curses-like fullscreen buffers if the terminal allows it
|
||||
if (clear_screen)
|
||||
if (g_terminal.initialized && clear_screen)
|
||||
{
|
||||
terminal_printer_fn printer = get_attribute_printer (stdout);
|
||||
tputs (clear_screen, 1, printer);
|
||||
|
Loading…
Reference in New Issue
Block a user