Crossterm.downFunction

Move the terminal cursor down by rows number of rows.

Crossterm.leftFunction

Move the terminal cursor left by columns number of columns.

Crossterm.nextFunction

Move the terminal cursor to the next line n times.

Crossterm.pollFunction

Poll the terminal for input events for duration (seconds)

Crossterm.pollMethod

Poll the terminal for input events for duration (Dates.Period)

Crossterm.prevFunction

Move the terminal cursor to the previous line n times.

Crossterm.rightFunction

Move the terminal cursor right by columns number of columns.

Crossterm.saveMethod

Save the current position of the terminal cursor.

Crossterm.toMethod

Move the terminal cursor to the specified (x, y) coordinates.

Crossterm.upFunction

Move the terminal cursor up by rows number of rows.

Crossterm.LibCrossterm.crossterm_KeyModifiersType
crossterm_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_MouseEventType
crossterm_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_TagType
crossterm_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_cursor_move_to_next_lineMethod
crossterm_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_event_pollMethod
crossterm_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_readMethod
crossterm_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_flushMethod
crossterm_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_style_printMethod
crossterm_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_stringMethod
crossterm_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_terminal_begin_synchronized_updateMethod
crossterm_terminal_begin_synchronized_update()

Instructs the terminal emulator to begin a synchronized frame.

Notes

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_end_synchronized_updateMethod
crossterm_terminal_end_synchronized_update()

Instructs the terminal to end a synchronized frame.

Notes

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_titleMethod
crossterm_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.