Crate coded_chars

source ·
Expand description

This crate implements the ECMA-48 standard for coded characters in rust.

Various constructions are provided to easily add control character and sequences inside text.

This crate is compatible with “ANSI terminals”.

§Standard implemented

  • ecma-48 - Control Functions for Coded Character Sets

§An example : format a text printed in an ECMA/ANSI terminal

use coded_chars::clear_screen;
use coded_chars::cursor::set_position;
use coded_chars::presentation::{format_str, select_graphic};

// Direct format
println!("Hello {}World{} !", select_graphic().fg_red().bold().underline(), select_graphic().default());

// Clear screen
clear_screen();

// Using format_str
let formatted = format_str(
    "World",
    select_graphic().fg_red().bold().underline()
 );
println!("Hello {} !", formatted);

set_position(5, 1).exec();
println!("This line is printed on the fifth line.");

§All ECMA-48 control functions

Other :

Modules§

  • Qualify and delimit areas.
  • This module provides control characters not sorted elsewhere….
  • This module defines the ControlSequence struct which represent sequence introduced by CSI.
  • This module helps move and set the cursor position.
  • Various delimiters.
  • Control sequences that are devices-related.
  • This module provides control function that change the display.
  • Helps edit text.
  • This module provides escape sequences not sorted elsewhere…
  • These control functions change the format.
  • Control sequence and other introducers.
  • This module helps create the CSI sequences for SM and RM.
  • This module provides control function to change the presentation.
  • All 7-bits and 8-bits shifts.
  • All transmission-related characters.

Functions§

  • The page is erased and the cursor position is set to the first line and the first column.