-
Notifications
You must be signed in to change notification settings - Fork 0
CursorMover
VetheonGames edited this page Jun 8, 2023
·
1 revision
The CursorMover
class is responsible for moving the cursor position in the DynamicCursesInput gem. It provides methods to move the cursor to the left or to the right.
This is a class method that moves the cursor one position to the left. It takes one parameter:
-
cursor_pos
: the current cursor position.
If the cursor is already at the start of the line (i.e., cursor_pos
is zero), it does not change the cursor position. Otherwise, it decreases the cursor position by 1.
This is a class method that moves the cursor one position to the right. It takes two parameters:
-
cursor_pos
: the current cursor position. -
length
: the length of the input string.
If the cursor is already at the end of the line (i.e., cursor_pos
is equal to length
), it does not change the cursor position. Otherwise, it increases the cursor position by 1.