Module terminal.text.stack
Terminal text-attribute stack module.
Manages a stack of text-attributes for terminal control.
Functions
apply () | Re-applies the current attributes/colors (at the top of the stack), and writes it to the terminal. |
apply_seq () | Re-applies the current attributes/colors (at the top of the stack), returns the sequence without writing to the terminal. |
pop ([n=1]) | Pops n attributes/colors off the stack, and writes the last one to the terminal. |
pop_seq ([n=1]) | Pops n attributes/colors off the stack (and returns the last one), without writing it to the terminal. |
push (attr) | Pushes the given attributes/colors onto the stack, and writes an ansi sequence to set the new attributes to the terminal. |
push_seq (attr) | Pushes the given attributes/colors onto the stack, and returns an ansi sequence to set the new attributes without writing it to the terminal. |
Functions
- apply ()
-
Re-applies the current attributes/colors (at the top of the stack), and writes it to the terminal.
Returns:
-
true
- apply_seq ()
-
Re-applies the current attributes/colors (at the top of the stack),
returns the sequence without writing to the terminal.
Returns:
-
string
ansi sequence to write to the terminal
- pop ([n=1])
-
Pops n attributes/colors off the stack, and writes the last one to the terminal.
Parameters:
- n number number of attributes to pop (default 1)
Returns:
-
true
- pop_seq ([n=1])
-
Pops n attributes/colors off the stack (and returns the last one), without writing it to the terminal.
Parameters:
- n number number of attributes to pop (default 1)
Returns:
-
string
ansi sequence to write to the terminal
- push (attr)
-
Pushes the given attributes/colors onto the stack, and writes an ansi sequence to set the new
attributes to the terminal.
Every element omitted in the
attr
table will be taken from the current top of the stack.Parameters:
- attr
table
the attributes to set, see
text.attrs
for details.
Returns:
-
true
- attr
table
the attributes to set, see
- push_seq (attr)
-
Pushes the given attributes/colors onto the stack, and returns an ansi sequence to set the new
attributes without writing it to the terminal.
Every element omitted in the
attr
table will be taken from the current top of the stack.Parameters:
- attr
table
the attributes to set, see
text.attrs
for details.
Returns:
-
string
ansi sequence to write to the terminal
- attr
table
the attributes to set, see