Crossterm.jl: A Cross-platform Terminal Manipulation Library in Julia
Crossterm is a Julia terminal manipulation library designed to write cross-platform text-based interfaces based on crossterm-rs/crossterm. It supports all UNIX and Windows terminals down to Windows 7.
The Julia interface provides simpler interface with functions like:
hide()
show()
up()
down()
left()
right()
next()
prev()
and more.
See API documentation below.
Crossterm.alternate_screen
— FunctionEnter or leave the alternate screen buffer of the terminal.
Crossterm.background
— FunctionSet background color
Crossterm.blinking
— FunctionEnable or disable cursor blinking in the terminal.
Crossterm.bracketed_paste
— FunctionEnable or disable bracketed paste mode in the terminal.
Crossterm.clear
— FunctionClear the terminal screen or a part of it.
Crossterm.clear_last_error
— MethodClear the last error message stored by the crossterm library.
Crossterm.column
— FunctionMove the terminal cursor to the column
.
Crossterm.cursor
— FunctionShow or hide cursor in the terminal.
Crossterm.cursor_style
— MethodSet the style of the terminal cursor.
Crossterm.down
— FunctionMove the terminal cursor down by rows
number of rows.
Crossterm.enhance_keyboard
— FunctionPush or pop the keyboard enhancement flags.
Crossterm.flush
— MethodFlush the stdout stream
Crossterm.focus_change
— FunctionEnable or disable focus change event reporting in the terminal.
Crossterm.foreground
— FunctionSet foreground color
Crossterm.hide
— MethodHide the terminal cursor.
Crossterm.last_error_message
— MethodReturn the most recent error message from the crossterm library.
Crossterm.left
— FunctionMove the terminal cursor left by columns
number of columns.
Crossterm.line_wrap
— FunctionEnable or disable line wrapping in the terminal.
Crossterm.mouse_capture
— FunctionEnable or disable mouse capture event reporting in the terminal.
Crossterm.next
— FunctionMove the terminal cursor to the next line n
times.
Crossterm.poll
— FunctionPoll the terminal for input events for duration (seconds)
Crossterm.poll
— MethodPoll the terminal for input events for duration (Dates.Period)
Crossterm.position
— MethodSet the position of the terminal cursor to p
coordinates.
Crossterm.position
— MethodSet the position of the terminal cursor to p
coordinates.
Crossterm.position
— MethodGet the current position of the terminal cursor.
Crossterm.prev
— FunctionMove the terminal cursor to the previous line n
times.
Crossterm.print
— MethodPrint to stdout
Crossterm.print
— MethodPrint to stdout
Crossterm.raw_mode
— FunctionEnable or disable raw mode in the terminal.
Crossterm.read
— MethodRead an event from the terminal.
Crossterm.reset_color
— MethodReset terminal colors to default.
Crossterm.restore
— MethodRestore the terminal cursor to the last saved position.
Crossterm.right
— FunctionMove the terminal cursor right by columns
number of columns.
Crossterm.row
— FunctionMove the terminal cursor to the row
.
Crossterm.save
— MethodSave the current position of the terminal cursor.
Crossterm.scroll_down
— FunctionScroll the terminal screen down by n
lines.
Crossterm.scroll_up
— FunctionScroll the terminal screen up by n
lines.
Crossterm.show
— MethodShow the terminal cursor.
Crossterm.size
— MethodSet the size of the terminal.
Crossterm.size
— MethodGet the size of the terminal.
Crossterm.stderr
— FunctionUse stdout or stderr for all commands.
Crossterm.style
— MethodSet the text attribute in the terminal.
Crossterm.title
— MethodSet the title of the terminal.
Crossterm.to
— MethodMove the terminal cursor to the specified (x, y) coordinates.
Crossterm.underline
— FunctionSet underline color
Crossterm.up
— FunctionMove the terminal cursor up by rows
number of rows.
Crossterm.CursorStyle
— ModuleCursorStyle
Different styles for the terminal cursor.
Crossterm.ClearType
— Modulecrossterm_ClearType
Different ways to clear the terminal buffer.
Full C-API documentation is below
Crossterm.LibCrossterm.crossterm_ClearType
— Typecrossterm_ClearType
Different ways to clear the terminal buffer.
Crossterm.LibCrossterm.crossterm_CursorStyle
— Typecrossterm_CursorStyle
Style of the cursor. It uses two types of escape codes, one to control blinking, and the other the shape.
Crossterm.LibCrossterm.crossterm_Event_Tag
— Typecrossterm_Event_Tag
Represents an event.
Crossterm.LibCrossterm.crossterm_KeyCode_Tag
— Typecrossterm_KeyCode_Tag
Represents a key.
Crossterm.LibCrossterm.crossterm_KeyEvent
— Typecrossterm_KeyEvent
Represents a key event.
Crossterm.LibCrossterm.crossterm_KeyEventKind
— Typecrossterm_KeyEventKind
Represents a keyboard event kind.
Crossterm.LibCrossterm.crossterm_KeyEventState
— Typecrossterm_KeyEventState
Represents extra state about the key event.
Note: This state can only be read if [KeyboardEnhancementFlags::DISAMBIGUATE\_ESCAPE\_CODES
] has been enabled with [crossterm_event_push_keyboard_enhancement_flags
].
Crossterm.LibCrossterm.crossterm_KeyModifiers
— Typecrossterm_KeyModifiers
Represents key modifiers (shift, control, alt, etc.).
Note: SUPER
, HYPER
, and META
can only be read if [KeyboardEnhancementFlags::DISAMBIGUATE\_ESCAPE\_CODES
] has been enabled with [PushKeyboardEnhancementFlags
].
Crossterm.LibCrossterm.crossterm_MediaKeyCode
— Typecrossterm_MediaKeyCode
Represents a media key (as part of [KeyCode::Media
]).
Crossterm.LibCrossterm.crossterm_ModifierKeyCode
— Typecrossterm_ModifierKeyCode
Represents a modifier key (as part of [KeyCode::Modifier
]).
Crossterm.LibCrossterm.crossterm_MouseButton
— Typecrossterm_MouseButton
Represents a mouse button.
Crossterm.LibCrossterm.crossterm_MouseEvent
— Typecrossterm_MouseEvent
Represents a mouse event.
Platform-specific Notes
Mouse Buttons
Some platforms/terminals do not report mouse button for the MouseEventKind::Up
and MouseEventKind::Drag
events. MouseButton::Left
is returned if we don't know which button was used.
Key Modifiers
Some platforms/terminals does not report all key modifiers combinations for all mouse event types. For example - macOS reports Ctrl
+ left mouse button click as a right mouse button click.
Crossterm.LibCrossterm.crossterm_MouseEventKind_Tag
— Typecrossterm_MouseEventKind_Tag
A mouse event kind.
Platform-specific Notes
Mouse Buttons
Some platforms/terminals do not report mouse button for the MouseEventKind::Up
and MouseEventKind::Drag
events. MouseButton::Left
is returned if we don't know which button was used.
Crossterm.LibCrossterm.crossterm_colors
— Methodcrossterm_colors()
Returns colors as a UTF-8 JSON string.
Null character is stored in the last location of buffer. Caller is responsible for memory associated with string buffer. Use [crossterm_free_c_char
] to free data.
Crossterm.LibCrossterm.crossterm_cursor_disable_blinking
— Methodcrossterm_cursor_disable_blinking()
Disables blinking of the terminal cursor.
Crossterm.LibCrossterm.crossterm_cursor_enable_blinking
— Methodcrossterm_cursor_enable_blinking()
Enables blinking of the terminal cursor.
Crossterm.LibCrossterm.crossterm_cursor_hide
— Methodcrossterm_cursor_hide()
Hides the terminal cursor.
Crossterm.LibCrossterm.crossterm_cursor_move_down
— Methodcrossterm_cursor_move_down(rows)
Moves the terminal cursor a given number of rows down.
Crossterm.LibCrossterm.crossterm_cursor_move_left
— Methodcrossterm_cursor_move_left(cols)
Moves the terminal cursor a given number of cols to the left.
Crossterm.LibCrossterm.crossterm_cursor_move_right
— Methodcrossterm_cursor_move_right(cols)
Moves the terminal cursor a given number of cols to the right.
Crossterm.LibCrossterm.crossterm_cursor_move_to
— Methodcrossterm_cursor_move_to(col, row)
Moves the terminal cursor to the given position (col, row).
Notes * Top left cell is represented as 0,0
.
Crossterm.LibCrossterm.crossterm_cursor_move_to_column
— Methodcrossterm_cursor_move_to_column(col)
Moves the terminal cursor to the given col on the current row.
Crossterm.LibCrossterm.crossterm_cursor_move_to_next_line
— Methodcrossterm_cursor_move_to_next_line(n)
Moves the terminal cursor down the given number of lines and moves it to the first col.
Notes * This command is 1 based, meaning [
crosstermcursormovetonext_line](@ref)(1)
moves to the next line. * Most terminals default 0 argument to 1.
Crossterm.LibCrossterm.crossterm_cursor_move_to_previous_line
— Methodcrossterm_cursor_move_to_previous_line(n)
Moves the terminal cursor up the given number of lines and moves it to the first col.
Crossterm.LibCrossterm.crossterm_cursor_move_to_row
— Methodcrossterm_cursor_move_to_row(row)
Moves the terminal cursor to the given row on the current col.
Crossterm.LibCrossterm.crossterm_cursor_move_up
— Methodcrossterm_cursor_move_up(rows)
Moves the terminal cursor a given number of rows up.
Crossterm.LibCrossterm.crossterm_cursor_position
— Methodcrossterm_cursor_position(col, row)
Get cursor position (col, row)
Notes * Top left cell is represented as 0,0
.
Crossterm.LibCrossterm.crossterm_cursor_position_set
— Methodcrossterm_cursor_position_set(col, row)
Set cursor position (col, row)
Notes * Top left cell is represented as 0,0
.
Crossterm.LibCrossterm.crossterm_cursor_restore_position
— Methodcrossterm_cursor_restore_position()
Restores the saved terminal cursor position.
Crossterm.LibCrossterm.crossterm_cursor_save_position
— Methodcrossterm_cursor_save_position()
Saves the current terminal cursor position.
Crossterm.LibCrossterm.crossterm_cursor_show
— Methodcrossterm_cursor_show()
Shows the terminal cursor.
Crossterm.LibCrossterm.crossterm_cursor_style
— Methodcrossterm_cursor_style(cursor_style)
Sets the style of the cursor.
Crossterm.LibCrossterm.crossterm_cursor_style_blinking_bar
— Methodcrossterm_cursor_style_blinking_bar()
Sets the style of the cursor to a blinking bar.
Crossterm.LibCrossterm.crossterm_cursor_style_blinking_block
— Methodcrossterm_cursor_style_blinking_block()
Sets the style of the cursor to a blinking block.
Crossterm.LibCrossterm.crossterm_cursor_style_blinking_underscore
— Methodcrossterm_cursor_style_blinking_underscore()
Sets the style of the cursor to a blinking underscore.
Crossterm.LibCrossterm.crossterm_cursor_style_default_user_shape
— Methodcrossterm_cursor_style_default_user_shape()
Sets the style of the cursor to default user shape.
Crossterm.LibCrossterm.crossterm_cursor_style_steady_bar
— Methodcrossterm_cursor_style_steady_bar()
Sets the style of the cursor to a steady bar.
Crossterm.LibCrossterm.crossterm_cursor_style_steady_block
— Methodcrossterm_cursor_style_steady_block()
Sets the style of the cursor to a steady block.
Crossterm.LibCrossterm.crossterm_cursor_style_steady_underscore
— Methodcrossterm_cursor_style_steady_underscore()
Sets the style of the cursor to a steady underscore.
Crossterm.LibCrossterm.crossterm_event_disable_bracketed_paste
— Methodcrossterm_event_disable_bracketed_paste()
Disables bracketed paste mode.
Crossterm.LibCrossterm.crossterm_event_disable_focus_change
— Methodcrossterm_event_disable_focus_change()
Disable focus event emission.
Crossterm.LibCrossterm.crossterm_event_disable_mouse_capture
— Methodcrossterm_event_disable_mouse_capture()
Disable mouse event capturing.
Crossterm.LibCrossterm.crossterm_event_enable_bracketed_paste
— Methodcrossterm_event_enable_bracketed_paste()
Enables bracketed paste mode.
It should be paired with [crossterm_event_disable_bracketed_paste
] at the end of execution.
This is not supported in older Windows terminals without virtual terminal sequences.
Crossterm.LibCrossterm.crossterm_event_enable_focus_change
— Methodcrossterm_event_enable_focus_change()
Enable focus event emission.
It should be paired with [crossterm_event_disable_focus_change
] at the end of execution.
Focus events can be captured with [crossterm_event_read
].
Crossterm.LibCrossterm.crossterm_event_enable_mouse_capture
— Methodcrossterm_event_enable_mouse_capture()
Enable mouse event capturing.
Crossterm.LibCrossterm.crossterm_event_poll
— Methodcrossterm_event_poll(secs, nanos)
Checks if there is an [Event
] available.
Returns 1
if an [Event
] is available, it returns 0
if no [Event
] is available, returns -1 if error has occurred.
When it returns 1
, that guarantees that subsequent call to the [crossterm_event_read
] function won't block.
Arguments
timeout_secs
- maximum waiting time for event availability *timeout_nanos
- maximum waiting time for event availability
Crossterm.LibCrossterm.crossterm_event_pop_keyboard_enhancement_flags
— Methodcrossterm_event_pop_keyboard_enhancement_flags()
Disables extra kinds of keyboard events.
Crossterm.LibCrossterm.crossterm_event_push_keyboard_enhancement_flags
— Methodcrossterm_event_push_keyboard_enhancement_flags(flags)
Enables the kitty keyboard protocol, which adds extra information to keyboard events and removes ambiguity for modifier keys. It should be paired with [crossterm_pop_keyboard_enhancement_flags
] at the end of execution.
Crossterm.LibCrossterm.crossterm_event_read
— Methodcrossterm_event_read()
Reads a single [Event
] as a UTF-8 JSON string. If error occurs during read, error will be returned as a UTF-8 JSON string.
This function blocks until an [Event
] is available. Combine it with the [crossterm_event_poll
] function to get non-blocking reads.
Caller is responsible for memory associated with string buffer. Use [crossterm_free_c_char
] to free data.
Crossterm.LibCrossterm.crossterm_flush
— Methodcrossterm_flush()
Flush the stdout stream, ensuring that all intermediately buffered contents reach their destination.
It is considered an error if not all bytes could be written due to I/O errors or EOF being reached.
Crossterm.LibCrossterm.crossterm_free_c_char
— Methodcrossterm_free_c_char(s)
Frees data behind pointer to UTF-8 string allocated by this crate
Null character is stored in the last location of buffer.
Crossterm.LibCrossterm.crossterm_has_error
— Methodcrossterm_has_error()
Check whether error has been set.
Crossterm.LibCrossterm.crossterm_last_error_length
— Methodcrossterm_last_error_length()
Calculate the number of bytes in the last error's error message including a trailing null
character. If there are no recent error, then this returns 0
.
Crossterm.LibCrossterm.crossterm_last_error_message
— Methodcrossterm_last_error_message()
Return most recent error message into a UTF-8 string buffer.
Null character is stored in the last location of buffer. Caller is responsible for memory associated with string buffer. Use [crossterm_free_c_char
] to free data.
Crossterm.LibCrossterm.crossterm_sleep
— Methodcrossterm_sleep(seconds)
Sleeps for n seconds where n is the argument to this function
Crossterm.LibCrossterm.crossterm_style_attribute
— Methodcrossterm_style_attribute(attr)
Sets an attribute.
See [Attribute
] for more info.
Crossterm.LibCrossterm.crossterm_style_attribute_bold
— Methodcrossterm_style_attribute_bold()
Sets the Bold
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_crossed_out
— Methodcrossterm_style_attribute_crossed_out()
Sets the CrossedOut
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_dim
— Methodcrossterm_style_attribute_dim()
Sets the Dim
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_double_underlined
— Methodcrossterm_style_attribute_double_underlined()
Sets the DoubleUnderlined
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_fraktur
— Methodcrossterm_style_attribute_fraktur()
Sets the Fraktur
attribute.
crossterm_style_attribute_hidden()
Sets the Hidden
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_italic
— Methodcrossterm_style_attribute_italic()
Sets the Italic
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_no_blink
— Methodcrossterm_style_attribute_no_blink()
Sets the NoBlink
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_no_bold
— Methodcrossterm_style_attribute_no_bold()
Sets the NoBold
attribute.
crossterm_style_attribute_no_hidden()
Sets the NoHidden
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_no_italic
— Methodcrossterm_style_attribute_no_italic()
Sets the NoItalic
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_no_reverse
— Methodcrossterm_style_attribute_no_reverse()
Sets the NoReverse
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_no_underline
— Methodcrossterm_style_attribute_no_underline()
Sets the NoUnderline
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_normal_intensity
— Methodcrossterm_style_attribute_normal_intensity()
Sets the NormalIntensity
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_not_crossed_out
— Methodcrossterm_style_attribute_not_crossed_out()
Sets the NotCrossedOut
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_rapid_blink
— Methodcrossterm_style_attribute_rapid_blink()
Sets the RapidBlink
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_reset
— Methodcrossterm_style_attribute_reset()
Sets the Reset
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_reverse
— Methodcrossterm_style_attribute_reverse()
Sets the Reverse
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_slow_blink
— Methodcrossterm_style_attribute_slow_blink()
Sets the SlowBlink
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_undercurled
— Methodcrossterm_style_attribute_undercurled()
Sets the Undercurled
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_underdashed
— Methodcrossterm_style_attribute_underdashed()
Sets the Underdashed
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_underdotted
— Methodcrossterm_style_attribute_underdotted()
Sets the Underdotted
attribute.
Crossterm.LibCrossterm.crossterm_style_attribute_underlined
— Methodcrossterm_style_attribute_underlined()
Sets the Underlined
attribute.
Crossterm.LibCrossterm.crossterm_style_background_color
— Methodcrossterm_style_background_color(color)
Sets the the background color.
See [Color
] for more info.
Crossterm.LibCrossterm.crossterm_style_background_color_ansi
— Methodcrossterm_style_background_color_ansi(value)
Sets the the background color to an ANSI value.
Crossterm.LibCrossterm.crossterm_style_background_color_black
— Methodcrossterm_style_background_color_black()
Sets the the background color to Black.
Crossterm.LibCrossterm.crossterm_style_background_color_blue
— Methodcrossterm_style_background_color_blue()
Sets the the background color to Blue.
Crossterm.LibCrossterm.crossterm_style_background_color_cyan
— Methodcrossterm_style_background_color_cyan()
Sets the the background color to Cyan.
Crossterm.LibCrossterm.crossterm_style_background_color_dark_blue
— Methodcrossterm_style_background_color_dark_blue()
Sets the the background color to DarkBlue.
Crossterm.LibCrossterm.crossterm_style_background_color_dark_cyan
— Methodcrossterm_style_background_color_dark_cyan()
Sets the the background color to DarkCyan.
Crossterm.LibCrossterm.crossterm_style_background_color_dark_green
— Methodcrossterm_style_background_color_dark_green()
Sets the the background color to DarkGreen.
Crossterm.LibCrossterm.crossterm_style_background_color_dark_grey
— Methodcrossterm_style_background_color_dark_grey()
Sets the the background color to DarkGrey.
Crossterm.LibCrossterm.crossterm_style_background_color_dark_magenta
— Methodcrossterm_style_background_color_dark_magenta()
Sets the the background color to DarkMagenta.
Crossterm.LibCrossterm.crossterm_style_background_color_dark_red
— Methodcrossterm_style_background_color_dark_red()
Sets the the background color to DarkRed.
Crossterm.LibCrossterm.crossterm_style_background_color_dark_yellow
— Methodcrossterm_style_background_color_dark_yellow()
Sets the the background color to DarkYellow.
Crossterm.LibCrossterm.crossterm_style_background_color_green
— Methodcrossterm_style_background_color_green()
Sets the the background color to Green.
Crossterm.LibCrossterm.crossterm_style_background_color_grey
— Methodcrossterm_style_background_color_grey()
Sets the the background color to Grey.
Crossterm.LibCrossterm.crossterm_style_background_color_magenta
— Methodcrossterm_style_background_color_magenta()
Sets the the background color to Magenta.
Crossterm.LibCrossterm.crossterm_style_background_color_red
— Methodcrossterm_style_background_color_red()
Sets the the background color to Red.
Crossterm.LibCrossterm.crossterm_style_background_color_reset
— Methodcrossterm_style_background_color_reset()
Sets the the background color to Reset.
Crossterm.LibCrossterm.crossterm_style_background_color_rgb
— Methodcrossterm_style_background_color_rgb(r, g, b)
Sets the the background color in RGB.
Crossterm.LibCrossterm.crossterm_style_background_color_white
— Methodcrossterm_style_background_color_white()
Sets the the background color to White.
Crossterm.LibCrossterm.crossterm_style_background_color_yellow
— Methodcrossterm_style_background_color_yellow()
Sets the the background color to Yellow.
Crossterm.LibCrossterm.crossterm_style_foreground_color
— Methodcrossterm_style_foreground_color(color)
Sets the the foreground color.
See [Color
] for more info.
Crossterm.LibCrossterm.crossterm_style_foreground_color_ansi
— Methodcrossterm_style_foreground_color_ansi(value)
Sets the the foreground color to an ANSI value.
Crossterm.LibCrossterm.crossterm_style_foreground_color_black
— Methodcrossterm_style_foreground_color_black()
Sets the the foreground color to Black.
Crossterm.LibCrossterm.crossterm_style_foreground_color_blue
— Methodcrossterm_style_foreground_color_blue()
Sets the the foreground color to Blue.
Crossterm.LibCrossterm.crossterm_style_foreground_color_cyan
— Methodcrossterm_style_foreground_color_cyan()
Sets the the foreground color to Cyan.
Crossterm.LibCrossterm.crossterm_style_foreground_color_dark_blue
— Methodcrossterm_style_foreground_color_dark_blue()
Sets the the foreground color to DarkBlue.
Crossterm.LibCrossterm.crossterm_style_foreground_color_dark_cyan
— Methodcrossterm_style_foreground_color_dark_cyan()
Sets the the foreground color to DarkCyan.
Crossterm.LibCrossterm.crossterm_style_foreground_color_dark_green
— Methodcrossterm_style_foreground_color_dark_green()
Sets the the foreground color to DarkGreen.
Crossterm.LibCrossterm.crossterm_style_foreground_color_dark_grey
— Methodcrossterm_style_foreground_color_dark_grey()
Sets the the foreground color to DarkGrey.
Crossterm.LibCrossterm.crossterm_style_foreground_color_dark_magenta
— Methodcrossterm_style_foreground_color_dark_magenta()
Sets the the foreground color to DarkMagenta.
Crossterm.LibCrossterm.crossterm_style_foreground_color_dark_red
— Methodcrossterm_style_foreground_color_dark_red()
Sets the the foreground color to DarkRed.
Crossterm.LibCrossterm.crossterm_style_foreground_color_dark_yellow
— Methodcrossterm_style_foreground_color_dark_yellow()
Sets the the foreground color to DarkYellow.
Crossterm.LibCrossterm.crossterm_style_foreground_color_green
— Methodcrossterm_style_foreground_color_green()
Sets the the foreground color to Green.
Crossterm.LibCrossterm.crossterm_style_foreground_color_grey
— Methodcrossterm_style_foreground_color_grey()
Sets the the foreground color to Grey.
Crossterm.LibCrossterm.crossterm_style_foreground_color_magenta
— Methodcrossterm_style_foreground_color_magenta()
Sets the the foreground color to Magenta.
Crossterm.LibCrossterm.crossterm_style_foreground_color_red
— Methodcrossterm_style_foreground_color_red()
Sets the the foreground color to Red.
Crossterm.LibCrossterm.crossterm_style_foreground_color_reset
— Methodcrossterm_style_foreground_color_reset()
Sets the the foreground color to Reset.
Crossterm.LibCrossterm.crossterm_style_foreground_color_rgb
— Methodcrossterm_style_foreground_color_rgb(r, g, b)
Sets the the foreground color in RGB.
Crossterm.LibCrossterm.crossterm_style_foreground_color_white
— Methodcrossterm_style_foreground_color_white()
Sets the the foreground color to White.
Crossterm.LibCrossterm.crossterm_style_foreground_color_yellow
— Methodcrossterm_style_foreground_color_yellow()
Sets the the foreground color to Yellow.
Crossterm.LibCrossterm.crossterm_style_print
— Methodcrossterm_style_print(s)
Print string to stdout
Safety
This function takes a raw pointer as argument. As such, the caller must ensure that: - The title
pointer points to a valid null-terminated string. - This function borrows a slice to a valid null-terminated string and the memory referenced by title
won't be deallocated or modified for the duration of the function call.. - The title
pointer is correctly aligned and title
points to an initialized memory.
If these conditions are not met, the behavior is undefined.
Crossterm.LibCrossterm.crossterm_style_print_char
— Methodcrossterm_style_print_char(c)
Print char to stdout
Crossterm.LibCrossterm.crossterm_style_print_string
— Methodcrossterm_style_print_string(s)
Print string to stdout
Safety
This function takes a raw pointer as argument. As such, the caller must ensure that: - The title
pointer points to a valid null-terminated string. - This function borrows a slice to a valid null-terminated string and the memory referenced by title
won't be deallocated or modified for the duration of the function call.. - The title
pointer is correctly aligned and title
points to an initialized memory.
If these conditions are not met, the behavior is undefined.
Crossterm.LibCrossterm.crossterm_style_reset_color
— Methodcrossterm_style_reset_color()
Resets the colors back to default.
Crossterm.LibCrossterm.crossterm_style_underline_color
— Methodcrossterm_style_underline_color(color)
Sets the the underline color.
See [Color
] for more info.
Crossterm.LibCrossterm.crossterm_style_underline_color_ansi
— Methodcrossterm_style_underline_color_ansi(value)
Sets the the underline color to an ANSI value.
Crossterm.LibCrossterm.crossterm_style_underline_color_black
— Methodcrossterm_style_underline_color_black()
Sets the the underline color to Black.
Crossterm.LibCrossterm.crossterm_style_underline_color_blue
— Methodcrossterm_style_underline_color_blue()
Sets the the underline color to Blue.
Crossterm.LibCrossterm.crossterm_style_underline_color_cyan
— Methodcrossterm_style_underline_color_cyan()
Sets the the underline color to Cyan.
Crossterm.LibCrossterm.crossterm_style_underline_color_dark_blue
— Methodcrossterm_style_underline_color_dark_blue()
Sets the the underline color to DarkBlue.
Crossterm.LibCrossterm.crossterm_style_underline_color_dark_cyan
— Methodcrossterm_style_underline_color_dark_cyan()
Sets the the underline color to DarkCyan.
Crossterm.LibCrossterm.crossterm_style_underline_color_dark_green
— Methodcrossterm_style_underline_color_dark_green()
Sets the the underline color to DarkGreen.
Crossterm.LibCrossterm.crossterm_style_underline_color_dark_grey
— Methodcrossterm_style_underline_color_dark_grey()
Sets the the underline color to DarkGrey.
Crossterm.LibCrossterm.crossterm_style_underline_color_dark_magenta
— Methodcrossterm_style_underline_color_dark_magenta()
Sets the the underline color to DarkMagenta.
Crossterm.LibCrossterm.crossterm_style_underline_color_dark_red
— Methodcrossterm_style_underline_color_dark_red()
Sets the the underline color to DarkRed.
Crossterm.LibCrossterm.crossterm_style_underline_color_dark_yellow
— Methodcrossterm_style_underline_color_dark_yellow()
Sets the the underline color to DarkYellow.
Crossterm.LibCrossterm.crossterm_style_underline_color_green
— Methodcrossterm_style_underline_color_green()
Sets the the underline color to Green.
Crossterm.LibCrossterm.crossterm_style_underline_color_grey
— Methodcrossterm_style_underline_color_grey()
Sets the the underline color to Grey.
Crossterm.LibCrossterm.crossterm_style_underline_color_magenta
— Methodcrossterm_style_underline_color_magenta()
Sets the the underline color to Magenta.
Crossterm.LibCrossterm.crossterm_style_underline_color_red
— Methodcrossterm_style_underline_color_red()
Sets the the underline color to Red.
Crossterm.LibCrossterm.crossterm_style_underline_color_reset
— Methodcrossterm_style_underline_color_reset()
Sets the the underline color to Reset.
Crossterm.LibCrossterm.crossterm_style_underline_color_rgb
— Methodcrossterm_style_underline_color_rgb(r, g, b)
Sets the the underline color in RGB.
Crossterm.LibCrossterm.crossterm_style_underline_color_white
— Methodcrossterm_style_underline_color_white()
Sets the the underline color to White.
Crossterm.LibCrossterm.crossterm_style_underline_color_yellow
— Methodcrossterm_style_underline_color_yellow()
Sets the the underline color to Yellow.
Crossterm.LibCrossterm.crossterm_terminal_begin_synchronized_update
— Methodcrossterm_terminal_begin_synchronized_update()
Instructs the terminal emulator to begin a synchronized frame.
Notes
- Commands must be executed/queued for execution otherwise they do nothing. * Use [
crossterm_terminal_end_synchronized_update
] command to leave the entered alternate screen.
When rendering the screen of the terminal, the Emulator usually iterates through each visible grid cell and renders its current state. With applications updating the screen a at higher frequency this can cause tearing.
This mode attempts to mitigate that.
When the synchronization mode is enabled following render calls will keep rendering the last rendered state. The terminal Emulator keeps processing incoming text and sequences. When the synchronized update mode is disabled again the renderer may fetch the latest screen buffer state again, effectively avoiding the tearing effect by unintentionally rendering in the middle a of an application screen update.
Crossterm.LibCrossterm.crossterm_terminal_clear
— Methodcrossterm_terminal_clear(ct)
Clear screen command.
Crossterm.LibCrossterm.crossterm_terminal_disable_line_wrap
— Methodcrossterm_terminal_disable_line_wrap()
Disables line wrapping.
Crossterm.LibCrossterm.crossterm_terminal_disable_raw_mode
— Methodcrossterm_terminal_disable_raw_mode()
Disables raw mode.
Crossterm.LibCrossterm.crossterm_terminal_enable_line_wrap
— Methodcrossterm_terminal_enable_line_wrap()
Enables line wrapping.
Crossterm.LibCrossterm.crossterm_terminal_enable_raw_mode
— Methodcrossterm_terminal_enable_raw_mode()
Enables raw mode.
Crossterm.LibCrossterm.crossterm_terminal_end_synchronized_update
— Methodcrossterm_terminal_end_synchronized_update()
Instructs the terminal to end a synchronized frame.
Notes
- Commands must be executed/queued for execution otherwise they do nothing. * Use [
crossterm_terminal_begin_synchronized_update
] to enter the alternate screen.
When rendering the screen of the terminal, the Emulator usually iterates through each visible grid cell and renders its current state. With applications updating the screen a at higher frequency this can cause tearing.
This mode attempts to mitigate that.
When the synchronization mode is enabled following render calls will keep rendering the last rendered state. The terminal Emulator keeps processing incoming text and sequences. When the synchronized update mode is disabled again the renderer may fetch the latest screen buffer state again, effectively avoiding the tearing effect by unintentionally rendering in the middle a of an application screen update.
Crossterm.LibCrossterm.crossterm_terminal_enter_alternate_screen
— Methodcrossterm_terminal_enter_alternate_screen()
Enters alternate screen.
Crossterm.LibCrossterm.crossterm_terminal_leave_alternate_screen
— Methodcrossterm_terminal_leave_alternate_screen()
Leaves alternate screen.
Crossterm.LibCrossterm.crossterm_terminal_ring_bell
— Methodcrossterm_terminal_ring_bell()
Instructs the terminal to send a bell.
Crossterm.LibCrossterm.crossterm_terminal_scroll_down
— Methodcrossterm_terminal_scroll_down(n)
Scroll down command.
Crossterm.LibCrossterm.crossterm_terminal_scroll_up
— Methodcrossterm_terminal_scroll_up(n)
Scroll up command.
Crossterm.LibCrossterm.crossterm_terminal_size
— Methodcrossterm_terminal_size(width, height)
Get terminal size
Crossterm.LibCrossterm.crossterm_terminal_size_set
— Methodcrossterm_terminal_size_set(cols, rows)
Sets the terminal buffer size (cols, rows)
.
Crossterm.LibCrossterm.crossterm_terminal_title
— Methodcrossterm_terminal_title(title)
Sets terminal title.
Safety
This function takes a raw pointer as argument. As such, the caller must ensure that: - The title
pointer points to a valid null-terminated string. - This function borrows a slice to a valid null-terminated string and the memory referenced by title
won't be deallocated or modified for the duration of the function call.. - The title
pointer is correctly aligned and title
points to an initialized memory.
If these conditions are not met, the behavior is undefined.
Crossterm.LibCrossterm.crossterm_use_stderr
— Methodcrossterm_use_stderr()
Use std::io::stderr()
for all commands
Crossterm.LibCrossterm.crossterm_use_stdout
— Methodcrossterm_use_stdout()
Use std::io::stdout()
for all commands