multi: completely remove fx.term dependency when interactive support is disabled
This commit is contained in:
@@ -137,10 +137,14 @@ enum bshell_status bshell_table_ctx_prepare_columns_from_format(
|
||||
|
||||
ctx->ctx_columns = columns;
|
||||
ctx->ctx_columns_count = fmt->fmt_column_count;
|
||||
ctx->ctx_tty_width = 0;
|
||||
|
||||
#if BSHELL_INTERACTIVE == 1
|
||||
fx_tty_get_dimensions(fx_stdtty, &ctx->ctx_tty_width, NULL);
|
||||
#endif
|
||||
|
||||
if (!ctx->ctx_tty_width) {
|
||||
ctx->ctx_tty_width = 150;
|
||||
ctx->ctx_tty_width = 80;
|
||||
}
|
||||
|
||||
ctx->ctx_variable_columns_count = 0;
|
||||
@@ -208,10 +212,14 @@ enum bshell_status bshell_table_ctx_prepare_columns_from_object(
|
||||
|
||||
ctx->ctx_columns = columns;
|
||||
ctx->ctx_columns_count = column_count;
|
||||
ctx->ctx_tty_width = 0;
|
||||
|
||||
#if BSHELL_INTERACTIVE == 1
|
||||
fx_tty_get_dimensions(fx_stdtty, &ctx->ctx_tty_width, NULL);
|
||||
#endif
|
||||
|
||||
if (!ctx->ctx_tty_width) {
|
||||
ctx->ctx_tty_width = 150;
|
||||
ctx->ctx_tty_width = 80;
|
||||
}
|
||||
|
||||
ctx->ctx_variable_columns_count = 0;
|
||||
@@ -232,9 +240,23 @@ enum bshell_status bshell_table_ctx_prepare_columns_from_object(
|
||||
return BSHELL_SUCCESS;
|
||||
}
|
||||
|
||||
static void set_table_header_tty_colour(void)
|
||||
{
|
||||
#if BSHELL_INTERACTIVE == 1
|
||||
fx_printf("[bold,bright_green]");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void reset_tty_colour(void)
|
||||
{
|
||||
#if BSHELL_INTERACTIVE == 1
|
||||
fx_printf("[reset]");
|
||||
#endif
|
||||
}
|
||||
|
||||
enum bshell_status bshell_table_ctx_print_headers(struct bshell_table_ctx *ctx)
|
||||
{
|
||||
fx_printf("[bold,bright_green]");
|
||||
set_table_header_tty_colour();
|
||||
bool repeat = false;
|
||||
struct bshell_table_ctx_column *c = NULL;
|
||||
|
||||
@@ -293,7 +315,7 @@ enum bshell_status bshell_table_ctx_print_headers(struct bshell_table_ctx *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
fx_printf("[reset]");
|
||||
reset_tty_colour();
|
||||
fx_stream_write_char(ctx->ctx_out, '\n');
|
||||
return BSHELL_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user