diff --git a/CharacterDeleter.md b/CharacterDeleter.md new file mode 100644 index 0000000..4832082 --- /dev/null +++ b/CharacterDeleter.md @@ -0,0 +1,16 @@ +# CharacterDeleter Class + +The `CharacterDeleter` class is responsible for deleting characters in the input string in the DynamicCursesInput gem. It provides a method to delete a character at the current cursor position. + +## Methods + +### .delete(input, cursor_pos) + +This is a class method that deletes the character at the current cursor position. It takes two parameters: + +- `input`: the current input string. +- `cursor_pos`: the current cursor position. + +If the cursor is at the start of the line (i.e., `cursor_pos` is zero), it does not change the input string or the cursor position. Otherwise, it deletes the character at the cursor position and decreases the cursor position by 1. + +The method returns an array containing two elements: the updated input string and the updated cursor position.