diff --git a/CursorMover.md b/CursorMover.md new file mode 100644 index 0000000..63554aa --- /dev/null +++ b/CursorMover.md @@ -0,0 +1,22 @@ +# CursorMover Class + +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. + +## Methods + +### .left(cursor_pos) + +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. + +### .right(cursor_pos, length) + +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. \ No newline at end of file