ChafaTermInfo: Chafa Reference Manual

## ChafaTermInfo ChafaTermInfo — Describes a particular terminal type |

## Functions

ChafaTermInfo * | chafa_term_info_new ()
ChafaTermInfo * | chafa_term_info_copy ()
void | chafa_term_info_ref ()
void | chafa_term_info_unref ()
const gchar * | chafa_term_info_get_seq ()
gint | chafa_term_info_set_seq ()
gboolean | chafa_term_info_have_seq ()
void | chafa_term_info_supplement ()
gchar * | chafa_term_info_emit_reset_terminal_soft ()
gchar * | chafa_term_info_emit_reset_terminal_hard ()
gchar * | chafa_term_info_emit_reset_attributes ()
gchar * | chafa_term_info_emit_clear ()
gchar * | chafa_term_info_emit_cursor_to_pos ()
gchar * | chafa_term_info_emit_cursor_to_top_left ()
gchar * | chafa_term_info_emit_cursor_to_bottom_left ()
gchar * | chafa_term_info_emit_cursor_up ()
gchar * | chafa_term_info_emit_cursor_down ()
gchar * | chafa_term_info_emit_cursor_left ()
gchar * | chafa_term_info_emit_cursor_right ()
gchar * | chafa_term_info_emit_cursor_up_1 ()
gchar * | chafa_term_info_emit_cursor_down_1 ()
gchar * | chafa_term_info_emit_cursor_left_1 ()
gchar * | chafa_term_info_emit_cursor_right_1 ()
gchar * | chafa_term_info_emit_set_scrolling_rows ()
gchar * | chafa_term_info_emit_cursor_up_scroll ()
gchar * | chafa_term_info_emit_cursor_down_scroll ()
gchar * | chafa_term_info_emit_insert_cells ()
gchar * | chafa_term_info_emit_delete_cells ()
gchar * | chafa_term_info_emit_insert_rows ()
gchar * | chafa_term_info_emit_delete_rows ()
gchar * | chafa_term_info_emit_enable_cursor ()
gchar * | chafa_term_info_emit_disable_cursor ()
gchar * | chafa_term_info_emit_enable_echo ()
gchar * | chafa_term_info_emit_disable_echo ()
gchar * | chafa_term_info_emit_enable_insert ()
gchar * | chafa_term_info_emit_disable_insert ()
gchar * | chafa_term_info_emit_enable_wrap ()
gchar * | chafa_term_info_emit_disable_wrap ()
gchar * | chafa_term_info_emit_invert_colors ()
gchar * | chafa_term_info_emit_set_color_fg_16 ()
gchar * | chafa_term_info_emit_set_color_bg_16 ()
gchar * | chafa_term_info_emit_set_color_fgbg_16 ()
gchar * | chafa_term_info_emit_set_color_fg_256 ()
gchar * | chafa_term_info_emit_set_color_bg_256 ()
gchar * | chafa_term_info_emit_set_color_fgbg_256 ()
gchar * | chafa_term_info_emit_set_color_fg_direct ()
gchar * | chafa_term_info_emit_set_color_bg_direct ()
gchar * | chafa_term_info_emit_set_color_fgbg_direct ()
gchar * | chafa_term_info_emit_begin_sixels ()
gchar * | chafa_term_info_emit_end_sixels ()
gchar * | chafa_term_info_emit_repeat_char ()

## Types and Values

#define | CHAFA_TERM_SEQ_LENGTH_MAX
enum | ChafaTermSeq
typedef | ChafaTermInfo
#define | CHAFA_TERM_INFO_ERROR
enum | ChafaTermInfoError

## Description

A ChafaTermInfo describes the characteristics of one particular kind of display terminal. It stores control sequences that can be used to move the cursor, change text attributes, mark the beginning and end of sixel graphics data, etc.

ChafaTermInfo also implements an efficient low-level API for formatting these sequences with marshaled arguments so they can be sent to the terminal.

## Functions

### chafa_term_info_new ()

    ChafaTermInfo *
    chafa_term_info_new (void);

Creates a new, blank ChafaTermInfo.

#### Returns

The new ChafaTermInfo

Since: 1.6

### chafa_term_info_copy ()

    ChafaTermInfo *
    chafa_term_info_copy (const ChafaTermInfo *term_info);

Creates a new ChafaTermInfo that's a copy of `term_info` .

#### Parameters

term_info | A ChafaTermInfo to copy. |

#### Returns

The new ChafaTermInfo

Since: 1.6

### chafa_term_info_ref ()

    void
    chafa_term_info_ref (ChafaTermInfo *term_info);

Adds a reference to `term_info` .

#### Parameters

term_info | ChafaTermInfo to add a reference to. |

Since: 1.6

### chafa_term_info_unref ()

    void
    chafa_term_info_unref (ChafaTermInfo *term_info);

Removes a reference from `term_info` .

#### Parameters

term_info | ChafaTermInfo to remove a reference from. |

Since: 1.6

### chafa_term_info_get_seq ()

    const gchar *
    chafa_term_info_get_seq (ChafaTermInfo *term_info,
                             ChafaTermSeq seq);

Gets the string equivalent of `seq` stored in `term_info` .

#### Parameters

term_info | A ChafaTermInfo. |
seq | A ChafaTermSeq to query for. |

#### Returns

An unformatted string sequence, or `NULL` if not set.

Since: 1.6

### chafa_term_info_set_seq ()

    gint
    chafa_term_info_set_seq (ChafaTermInfo *term_info,
                             ChafaTermSeq seq,
                             const gchar *str,
                             GError **error);

Sets the control sequence string equivalent of `seq` stored in `term_info` to `str` .

The string may contain argument indexes to be substituted with integers on formatting. The indexes are preceded by a percentage character and start at 1, i.e. %1, %2, %3, etc.

The string's length after formatting must not exceed `CHAFA_TERM_SEQ_LENGTH_MAX` bytes. Each argument can add up to four digits, or three for those specified as 8-bit integers. If the string could potentially exceed this length when formatted, `chafa_term_info_set_seq()` will return `FALSE`.

If parsing fails or `str` is too long, any previously existing sequence will be left untouched.

Passing `NULL` for `str` clears the corresponding control sequence.

#### Parameters

term_info | A ChafaTermInfo. |
seq | A ChafaTermSeq to query for. |
str | A control sequence string, or `NULL` to clear. |
error | A return location for error details, or `NULL`. |

#### Returns

`TRUE` if parsing succeeded, `FALSE` otherwise

Since: 1.6

### chafa_term_info_have_seq ()

    gboolean
    chafa_term_info_have_seq (const ChafaTermInfo *term_info,
                              ChafaTermSeq seq);

Checks if `term_info` can emit `seq` .

#### Parameters

term_info | A ChafaTermInfo. |
seq | A ChafaTermSeq to query for. |

#### Returns

`TRUE` if `seq` can be emitted, `FALSE` otherwise

Since: 1.6

### chafa_term_info_supplement ()

    void
    chafa_term_info_supplement (ChafaTermInfo *term_info,
                                ChafaTermInfo *source);

Supplements missing sequences in `term_info` with ones copied from `source` .

#### Parameters

term_info | A ChafaTermInfo to supplement |
source | A ChafaTermInfo to copy from |

Since: 1.6

### chafa_term_info_emit_reset_terminal_soft ()

    gchar *
    chafa_term_info_emit_reset_terminal_soft
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_RESET_TERMINAL_SOFT.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_reset_terminal_hard ()

    gchar *
    chafa_term_info_emit_reset_terminal_hard
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_RESET_TERMINAL_HARD.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_reset_attributes ()

    gchar *
    chafa_term_info_emit_reset_attributes (const ChafaTermInfo *term_info,
                                           gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_RESET_ATTRIBUTES.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_clear ()

    gchar *
    chafa_term_info_emit_clear (const ChafaTermInfo *term_info,
                                gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_CLEAR.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_to_pos ()

    gchar *
    chafa_term_info_emit_cursor_to_pos (const ChafaTermInfo *term_info,
                                        gchar *dest,
                                        guint x,
                                        guint y);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_TO_POS.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
x | Offset from left edge of display, zero-indexed |
y | Offset from top edge of display, zero-indexed |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_to_top_left ()

    gchar *
    chafa_term_info_emit_cursor_to_top_left
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_TO_TOP_LEFT.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_to_bottom_left ()

    gchar *
    chafa_term_info_emit_cursor_to_bottom_left
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_TO_BOTTOM_LEFT.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_up ()

    gchar *
    chafa_term_info_emit_cursor_up (const ChafaTermInfo *term_info,
                                    gchar *dest,
                                    guint n);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_UP.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
n | Distance to move the cursor |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_down ()

    gchar *
    chafa_term_info_emit_cursor_down (const ChafaTermInfo *term_info,
                                      gchar *dest,
                                      guint n);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_DOWN.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
n | Distance to move the cursor |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_left ()

    gchar *
    chafa_term_info_emit_cursor_left (const ChafaTermInfo *term_info,
                                      gchar *dest,
                                      guint n);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_LEFT.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
n | Distance to move the cursor |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_right ()

    gchar *
    chafa_term_info_emit_cursor_right (const ChafaTermInfo *term_info,
                                       gchar *dest,
                                       guint n);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_RIGHT.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
n | Distance to move the cursor |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_up_1 ()

    gchar *
    chafa_term_info_emit_cursor_up_1 (const ChafaTermInfo *term_info,
                                      gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_UP_1.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_down_1 ()

    gchar *
    chafa_term_info_emit_cursor_down_1 (const ChafaTermInfo *term_info,
                                        gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_DOWN_1.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_left_1 ()

    gchar *
    chafa_term_info_emit_cursor_left_1 (const ChafaTermInfo *term_info,
                                        gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_LEFT_1.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_right_1 ()

    gchar *
    chafa_term_info_emit_cursor_right_1 (const ChafaTermInfo *term_info,
                                         gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_RIGHT_1.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_set_scrolling_rows ()

    gchar *
    chafa_term_info_emit_set_scrolling_rows
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest,
                                    guint top,
                                    guint bottom);

Prints the control sequence for CHAFA_TERM_SEQ_SET_SCROLLING_ROWS.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
top | First row in scrolling area, zero-indexed |
bottom | Last row in scrolling area, zero-indexed |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_up_scroll ()

    gchar *
    chafa_term_info_emit_cursor_up_scroll (const ChafaTermInfo *term_info,
                                           gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_UP_SCROLL.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_cursor_down_scroll ()

    gchar *
    chafa_term_info_emit_cursor_down_scroll
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_CURSOR_DOWN_SCROLL.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_insert_cells ()

    gchar *
    chafa_term_info_emit_insert_cells (const ChafaTermInfo *term_info,
                                       gchar *dest,
                                       guint n);

Prints the control sequence for CHAFA_TERM_SEQ_INSERT_CELLS.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
n | Number of cells to insert |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_delete_cells ()

    gchar *
    chafa_term_info_emit_delete_cells (const ChafaTermInfo *term_info,
                                       gchar *dest,
                                       guint n);

Prints the control sequence for CHAFA_TERM_SEQ_DELETE_CELLS.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
n | Number of cells to delete |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_insert_rows ()

    gchar *
    chafa_term_info_emit_insert_rows (const ChafaTermInfo *term_info,
                                      gchar *dest,
                                      guint n);

Prints the control sequence for CHAFA_TERM_SEQ_INSERT_ROWS.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
n | Number of rows to insert |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_delete_rows ()

    gchar *
    chafa_term_info_emit_delete_rows (const ChafaTermInfo *term_info,
                                      gchar *dest,
                                      guint n);

Prints the control sequence for CHAFA_TERM_SEQ_DELETE_ROWS.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
n | Number of rows to delete |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_enable_cursor ()

    gchar *
    chafa_term_info_emit_enable_cursor (const ChafaTermInfo *term_info,
                                        gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_ENABLE_CURSOR.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_disable_cursor ()

    gchar *
    chafa_term_info_emit_disable_cursor (const ChafaTermInfo *term_info,
                                         gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_DISABLE_CURSOR.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_enable_echo ()

    gchar *
    chafa_term_info_emit_enable_echo (const ChafaTermInfo *term_info,
                                      gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_ENABLE_ECHO.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_disable_echo ()

    gchar *
    chafa_term_info_emit_disable_echo (const ChafaTermInfo *term_info,
                                       gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_DISABLE_ECHO.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_enable_insert ()

    gchar *
    chafa_term_info_emit_enable_insert (const ChafaTermInfo *term_info,
                                        gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_ENABLE_INSERT.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_disable_insert ()

    gchar *
    chafa_term_info_emit_disable_insert (const ChafaTermInfo *term_info,
                                         gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_DISABLE_INSERT.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_enable_wrap ()

    gchar *
    chafa_term_info_emit_enable_wrap (const ChafaTermInfo *term_info,
                                      gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_ENABLE_WRAP.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_disable_wrap ()

    gchar *
    chafa_term_info_emit_disable_wrap (const ChafaTermInfo *term_info,
                                       gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_DISABLE_WRAP.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_invert_colors ()

    gchar *
    chafa_term_info_emit_invert_colors (const ChafaTermInfo *term_info,
                                        gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_INVERT_COLORS.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_set_color_fg_16 ()

    gchar *
    chafa_term_info_emit_set_color_fg_16 (const ChafaTermInfo *term_info,
                                          gchar *dest,
                                          guint8 pen);

Prints the control sequence for CHAFA_TERM_SEQ_SET_COLOR_FG_16.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
pen | Pen number, 0-15 |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_set_color_bg_16 ()

    gchar *
    chafa_term_info_emit_set_color_bg_16 (const ChafaTermInfo *term_info,
                                          gchar *dest,
                                          guint8 pen);

Prints the control sequence for CHAFA_TERM_SEQ_SET_COLOR_BG_16.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
pen | Pen number, 0-15 |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_set_color_fgbg_16 ()

    gchar *
    chafa_term_info_emit_set_color_fgbg_16
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest,
                                    guint8 fg_pen,
                                    guint8 bg_pen);

Prints the control sequence for CHAFA_TERM_SEQ_SET_COLOR_FGBG_16.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
fg_pen | Foreground pen number, 0-15 |
bg_pen | Background pen number, 0-15 |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_set_color_fg_256 ()

    gchar *
    chafa_term_info_emit_set_color_fg_256 (const ChafaTermInfo *term_info,
                                           gchar *dest,
                                           guint8 pen);

Prints the control sequence for CHAFA_TERM_SEQ_SET_COLOR_FG_256.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
pen | Pen number, 0-255 |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_set_color_bg_256 ()

    gchar *
    chafa_term_info_emit_set_color_bg_256 (const ChafaTermInfo *term_info,
                                           gchar *dest,
                                           guint8 pen);

Prints the control sequence for CHAFA_TERM_SEQ_SET_COLOR_BG_256.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
pen | Pen number, 0-255 |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_set_color_fgbg_256 ()

    gchar *
    chafa_term_info_emit_set_color_fgbg_256
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest,
                                    guint8 fg_pen,
                                    guint8 bg_pen);

Prints the control sequence for CHAFA_TERM_SEQ_SET_COLOR_FGBG_256.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
fg_pen | Foreground pen number, 0-255 |
bg_pen | Background pen number, 0-255 |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_set_color_fg_direct ()

    gchar *
    chafa_term_info_emit_set_color_fg_direct
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest,
                                    guint8 r,
                                    guint8 g,
                                    guint8 b);

Prints the control sequence for CHAFA_TERM_SEQ_SET_COLOR_FG_DIRECT.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
r | Red component, 0-255 |
g | Green component, 0-255 |
b | Blue component, 0-255 |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_set_color_bg_direct ()

    gchar *
    chafa_term_info_emit_set_color_bg_direct
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest,
                                    guint8 r,
                                    guint8 g,
                                    guint8 b);

Prints the control sequence for CHAFA_TERM_SEQ_SET_COLOR_BG_DIRECT.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
r | Red component, 0-255 |
g | Green component, 0-255 |
b | Blue component, 0-255 |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_set_color_fgbg_direct ()

    gchar *
    chafa_term_info_emit_set_color_fgbg_direct
                                   (const ChafaTermInfo *term_info,
                                    gchar *dest,
                                    guint8 fg_r,
                                    guint8 fg_g,
                                    guint8 fg_b,
                                    guint8 bg_r,
                                    guint8 bg_g,
                                    guint8 bg_b);

Prints the control sequence for CHAFA_TERM_SEQ_SET_COLOR_FGBG_DIRECT.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
fg_r | Foreground red component, 0-255 |
fg_g | Foreground green component, 0-255 |
fg_b | Foreground blue component, 0-255 |
bg_r | Background red component, 0-255 |
bg_g | Background green component, 0-255 |
bg_b | Background blue component, 0-255 |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_begin_sixels ()

    gchar *
    chafa_term_info_emit_begin_sixels (const ChafaTermInfo *term_info,
                                       gchar *dest,
                                       guint p1,
                                       guint p2,
                                       guint p3);

Prints the control sequence for CHAFA_TERM_SEQ_BEGIN_SIXELS.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

All three parameters (`p1` , `p2` and `p3` ) can normally be set to 0.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
p1 | Pixel aspect selector |
p2 | Background color selector |
p3 | Horizontal grid selector |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_end_sixels ()

    gchar *
    chafa_term_info_emit_end_sixels (const ChafaTermInfo *term_info,
                                     gchar *dest);

Prints the control sequence for CHAFA_TERM_SEQ_END_SIXELS.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

### chafa_term_info_emit_repeat_char ()

    gchar *
    chafa_term_info_emit_repeat_char (const ChafaTermInfo *term_info,
                                      gchar *dest,
                                      guint n);

Prints the control sequence for CHAFA_TERM_SEQ_REPEAT_CHAR.

`dest` must have enough space to hold CHAFA_TERM_SEQ_LENGTH_MAX bytes, even if the emitted sequence is shorter. The output will not be zero-terminated.

#### Parameters

term_info | A ChafaTermInfo |
dest | String destination |
n | Number of repetitions |

#### Returns

Pointer to first byte after emitted string

Since: 1.6

## Types and Values

### CHAFA_TERM_SEQ_LENGTH_MAX

    #define CHAFA_TERM_SEQ_LENGTH_MAX 48

### enum ChafaTermSeq

An enumeration of the control sequences supported by ChafaTermInfo.

#### Members

CHAFA_TERM_SEQ_RESET_TERMINAL_SOFT | Reset the terminal to configured defaults. |
CHAFA_TERM_SEQ_RESET_TERMINAL_HARD | Reset the terminal to factory defaults. |
CHAFA_TERM_SEQ_RESET_ATTRIBUTES | Reset active graphics rendition (colors and other attributes) to terminal defaults. |
CHAFA_TERM_SEQ_CLEAR | Clear the screen. |
CHAFA_TERM_SEQ_INVERT_COLORS | Invert foreground and background colors. |
CHAFA_TERM_SEQ_CURSOR_TO_TOP_LEFT | Move cursor to top left of screen. |
CHAFA_TERM_SEQ_CURSOR_TO_BOTTOM_LEFT | Move cursor to bottom left of screen. |
CHAFA_TERM_SEQ_CURSOR_TO_POS | Move cursor to specific position. |
CHAFA_TERM_SEQ_CURSOR_UP_1 | Move cursor up one cell. |
CHAFA_TERM_SEQ_CURSOR_UP | Move cursor up N cells. |
CHAFA_TERM_SEQ_CURSOR_DOWN_1 | Move cursor down one cell. |
CHAFA_TERM_SEQ_CURSOR_DOWN | Move cursor down N cells. |
CHAFA_TERM_SEQ_CURSOR_LEFT_1 | Move cursor left one cell. |
CHAFA_TERM_SEQ_CURSOR_LEFT | Move cursor left N cells. |
CHAFA_TERM_SEQ_CURSOR_RIGHT_1 | Move cursor right one cell. |
CHAFA_TERM_SEQ_CURSOR_RIGHT | Move cursor right N cells. |
CHAFA_TERM_SEQ_CURSOR_UP_SCROLL | Move cursor up one cell. Scroll area contents down when at the edge. |
CHAFA_TERM_SEQ_CURSOR_DOWN_SCROLL | Move cursor down one cell. Scroll area contents up when at the edge. |
CHAFA_TERM_SEQ_INSERT_CELLS | Insert blank cells at cursor position. |
CHAFA_TERM_SEQ_DELETE_CELLS | Delete cells at cursor position. |
CHAFA_TERM_SEQ_INSERT_ROWS | Insert rows at cursor position. |
CHAFA_TERM_SEQ_DELETE_ROWS | Delete rows at cursor position. |
CHAFA_TERM_SEQ_SET_SCROLLING_ROWS | Set scrolling area extents. |
CHAFA_TERM_SEQ_ENABLE_INSERT | Enable insert mode. |
CHAFA_TERM_SEQ_DISABLE_INSERT | Disable insert mode. |
CHAFA_TERM_SEQ_ENABLE_CURSOR | Show the cursor. |
CHAFA_TERM_SEQ_DISABLE_CURSOR | Hide the cursor. |
CHAFA_TERM_SEQ_ENABLE_ECHO | Make the terminal echo input locally. |
CHAFA_TERM_SEQ_DISABLE_ECHO | Don't echo input locally. |
CHAFA_TERM_SEQ_ENABLE_WRAP | Make cursor wrap around to the next row after output in the final column. |
CHAFA_TERM_SEQ_DISABLE_WRAP | Make cursor stay in place after output to the final column. |
CHAFA_TERM_SEQ_SET_COLOR_FG_DIRECT | Set foreground color (directcolor/truecolor). |
CHAFA_TERM_SEQ_SET_COLOR_BG_DIRECT | Set background color (directcolor/truecolor). |
CHAFA_TERM_SEQ_SET_COLOR_FGBG_DIRECT | Set foreground and background color (directcolor/truecolor). |
CHAFA_TERM_SEQ_SET_COLOR_FG_256 | Set foreground color (256 colors). |
CHAFA_TERM_SEQ_SET_COLOR_BG_256 | Set background color (256 colors). |
CHAFA_TERM_SEQ_SET_COLOR_FGBG_256 | Set foreground and background colors (256 colors). |
CHAFA_TERM_SEQ_SET_COLOR_FG_16 | Set foreground color (16 colors). |
CHAFA_TERM_SEQ_SET_COLOR_BG_16 | Set background color (16 colors). |
CHAFA_TERM_SEQ_SET_COLOR_FGBG_16 | Set foreground and background colors (16 colors). |
CHAFA_TERM_SEQ_BEGIN_SIXELS | Begin sixel image data. |
CHAFA_TERM_SEQ_END_SIXELS | End sixel image data. |
CHAFA_TERM_SEQ_REPEAT_CHAR | Repeat previous character N times. |
CHAFA_TERM_SEQ_MAX | Last control sequence plus one. |

### ChafaTermInfo

    typedef struct ChafaTermInfo ChafaTermInfo;

### CHAFA_TERM_INFO_ERROR

    #define CHAFA_TERM_INFO_ERROR (chafa_term_info_error_quark ())

Error domain for ChafaTermInfo. Errors in this domain will be from the ChafaTermInfoError enumeration. See GError for information on error domains.

### enum ChafaTermInfoError

Error codes returned by control sequence parsing.

#### Members

CHAFA_TERM_INFO_ERROR_SEQ_TOO_LONG | A control sequence could exceed CHAFA_TERM_SEQ_LENGTH_MAX bytes if formatted with maximum argument lengths. |
CHAFA_TERM_INFO_ERROR_BAD_ESCAPE | An illegal escape sequence was used. |
CHAFA_TERM_INFO_ERROR_BAD_ARGUMENTS | A control sequence specified more than the maximum number of arguments, or an argument index was out of range. |