Raxol.Terminal.Commands.Editor (Raxol v0.5.0)

View Source

Handles editor-related terminal commands.

Summary

Functions

Clears a line or part of a line based on the mode parameter.

Clears the screen based on the mode parameter.

Deletes a specified number of characters starting from the current cursor position. Characters to the right of the deleted characters are shifted left, and blank characters are added at the end.

Deletes a specified number of lines starting from the current cursor position. Lines below the deleted lines are shifted up, and blank lines are added at the bottom.

Erases a specified number of characters starting from the current cursor position. Characters are replaced with blank spaces using the default style.

Inserts a specified number of blank characters at the current cursor position. Characters to the right of the cursor are shifted right, and characters shifted off the end are discarded.

Inserts a specified number of blank lines at the current cursor position. Lines below the cursor are shifted down, and lines shifted off the bottom are discarded.

Functions

clear_line(emulator, mode, cursor_pos, default_style)

Clears a line or part of a line based on the mode parameter.

Parameters

  • emulator - The current emulator state
  • mode - The clear mode:
    • 0 - Clear from cursor to end of line
    • 1 - Clear from beginning of line to cursor
    • 2 - Clear entire line

Returns

  • Updated emulator state

clear_screen(emulator, mode, cursor_pos, default_style)

Clears the screen based on the mode parameter.

Parameters

  • emulator - The current emulator state
  • mode - The clear mode:
    • 0 - Clear from cursor to end of screen
    • 1 - Clear from beginning of screen to cursor
    • 2 - Clear entire screen
    • 3 - Clear entire screen and scrollback

Returns

  • Updated emulator state

delete_chars(buffer, row, col, count, default_style)

Deletes a specified number of characters starting from the current cursor position. Characters to the right of the deleted characters are shifted left, and blank characters are added at the end.

delete_lines(buffer, row, count, default_style)

Deletes a specified number of lines starting from the current cursor position. Lines below the deleted lines are shifted up, and blank lines are added at the bottom.

erase_chars(buffer, row, col, count, default_style)

Erases a specified number of characters starting from the current cursor position. Characters are replaced with blank spaces using the default style.

insert_chars(buffer, row, col, count, default_style)

Inserts a specified number of blank characters at the current cursor position. Characters to the right of the cursor are shifted right, and characters shifted off the end are discarded.

insert_lines(buffer, row, count, default_style)

Inserts a specified number of blank lines at the current cursor position. Lines below the cursor are shifted down, and lines shifted off the bottom are discarded.