Raxol.Terminal.Commands.CursorUtils (Raxol v2.0.1)
View SourceShared utility functions for cursor handling commands. Eliminates code duplication between CursorHandler and CSIHandler.
Summary
Functions
Calculates new cursor position based on direction and movement amount. Ensures the new position is within the emulator bounds.
Functions
@spec calculate_new_cursor_position( {non_neg_integer(), non_neg_integer()}, atom(), non_neg_integer(), pos_integer(), pos_integer() ) :: {non_neg_integer(), non_neg_integer()}
Calculates new cursor position based on direction and movement amount. Ensures the new position is within the emulator bounds.
Parameters
- current_pos: Current {row, col} position
- direction: Direction to move (:up, :down, :left, :right)
- amount: Number of positions to move
- width: Emulator width for boundary checking
- height: Emulator height for boundary checking
Returns
New {row, col} position clamped to bounds