MiniDevil As beautiful as a shell
drawing_output.c File Reference

Output rendering (draws command output in scrollable box) More...

#include "minishell_ui.h"
+ Include dependency graph for drawing_output.c:

Detailed Description

Output rendering (draws command output in scrollable box)

Definition in file drawing_output.c.

Functions

static void draw_line_content (t_ui *ui, int line_idx, int w)
 Write a single scrolled output line's content to STDOUT. More...
 
void draw_out_line (t_ui *ui, int y, int i, int w)
 Draw one raw inside the output box (including the side borders) More...
 
void draw_out_box (t_ui *ui)
 Draw the full output box with title and borders. More...
 
void redraw_output_only (t_ui *ui)
 Redraw only the output box interior rows without borders nor title. More...
 

Function Documentation

◆ draw_line_content()

static void draw_line_content ( t_ui ui,
int  line_idx,
int  w 
)
static

Write a single scrolled output line's content to STDOUT.

  • Truncate to w - 4 visible chars if line_idx is within the buffer
  • Fill remaining width with spaces
Parameters
uiUI state
line_idxLine index
wWidth of the output box in cols

Definition at line 25 of file drawing_output.c.

References t_out::lines, t_ui::out, and truncate_line().

Referenced by draw_out_line().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_out_line()

void draw_out_line ( t_ui ui,
int  y,
int  i,
int  w 
)

Draw one raw inside the output box (including the side borders)

Parameters
uiUI state
yTop row of the output box
iRow index within the box (0 based)
wWidth of the output box

Definition at line 57 of file drawing_output.c.

References BOX_V, C_FIRE2, draw_line_content(), t_ui::out, print_at(), RESET, and t_out::scroll.

Referenced by draw_out_box(), and redraw_output_only().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_out_box()

void draw_out_box ( t_ui ui)

Draw the full output box with title and borders.

THe box grows to fill the terminal from row 5 to the last 2 rows

Parameters
uiUI state

Definition at line 79 of file drawing_output.c.

References C_FIRE2, t_box::color, draw_box_bottom(), draw_box_title(), draw_out_line(), t_box::h, t_term::height, t_ui::term, t_box::w, WAIFU_BOX_W, t_term::width, t_box::x, and t_box::y.

Referenced by draw_ui().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redraw_output_only()

void redraw_output_only ( t_ui ui)

Redraw only the output box interior rows without borders nor title.

Used after scroll events in order to refresh content without full redraw

Parameters
uiUI state

Definition at line 106 of file drawing_output.c.

References draw_out_line(), t_term::height, t_ui::term, WAIFU_BOX_W, and t_term::width.

Referenced by handle_scroll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Go to the source code of this file.