ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
display.h File Reference

🖥️ Display Width and Terminal Centering Utilities More...

Go to the source code of this file.

Functions

int display_width (const char *text)
 Calculate the visible display width of text with ANSI escape codes.
 
int display_center_horizontal (const char *text, int terminal_width)
 Calculate left padding needed to center text horizontally.
 
int display_center_vertical (int content_height, int terminal_height)
 Calculate top padding needed to vertically center content.
 
int display_height (const char *text, int terminal_width)
 Calculate how many display lines text will consume when wrapped.
 

Detailed Description

🖥️ Display Width and Terminal Centering Utilities

Utilities for calculating display width of text with ANSI escape codes and Unicode characters, plus helpers for centering text in terminals.

These functions properly handle:

  • ANSI escape codes (stripped before width calculation)
  • UTF-8 multi-byte characters and wide characters
  • Unicode display width (CJK, emoji, combining marks)

Definition in file include/ascii-chat/util/display.h.