MiniDevil As beautiful as a shell
drawing.c File Reference

Main drawing (renders command box, output & waifu) More...

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

Detailed Description

Main drawing (renders command box, output & waifu)

Definition in file drawing.c.

Functions

void draw_cmd_box (t_ui *ui)
 Draw the command input box (top left of the UI) More...
 
void draw_exit_box (t_ui *ui)
 Draw the exit code status box (right sidebare, below waifu) More...
 
void draw_ui (t_ui *ui)
 Clear the screen and redraw the UI from scratch. More...
 
void redraw_cmd_only (t_ui *ui)
 Redraws only the command input line. More...
 

Function Documentation

◆ draw_cmd_box()

void draw_cmd_box ( t_ui ui)

Draw the command input box (top left of the UI)

Render a titled box with a block cursor

Parameters
uiUI state

Definition at line 22 of file drawing.c.

References BOLD, t_cmd::buf, C_FIRE3, C_FIRE4, t_ui::cmd, t_box::color, draw_box_bottom(), draw_box_sides(), draw_box_title(), t_box::h, t_cmd::len, print_at(), RESET, 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:

◆ draw_exit_box()

void draw_exit_box ( t_ui ui)

Draw the exit code status box (right sidebare, below waifu)

Colours the exit code green on success and red on failure

Parameters
uiUI state

Definition at line 50 of file drawing.c.

References BOLD, C_FIRE1, C_FIRE2, C_FIRE5, t_box::color, draw_box(), EXIT_BOX_H, t_out::exit_code, t_box::h, t_ui::out, print_at(), RESET, 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:

◆ draw_ui()

void draw_ui ( t_ui ui)

Clear the screen and redraw the UI from scratch.

Draw all 4 panels: command box, waifu, exit box and output box

Parameters
uiUI state

Definition at line 76 of file drawing.c.

References CLEAR_SCREEN, draw_cmd_box(), draw_exit_box(), draw_out_box(), and draw_waifu_box().

Referenced by check_resize(), and ui_loop().

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

◆ redraw_cmd_only()

void redraw_cmd_only ( t_ui ui)

Redraws only the command input line.

Parameters
uiUI state

Definition at line 90 of file drawing.c.

References BOLD, t_cmd::buf, C_FIRE4, t_ui::cmd, t_cmd::len, print_at(), RESET, t_ui::term, WAIFU_BOX_W, and t_term::width.

Referenced by ui_loop().

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

Go to the source code of this file.