Created CharacterDeleter (markdown)
parent
0a8cbe207c
commit
31528c5c9d
16
CharacterDeleter.md
Normal file
16
CharacterDeleter.md
Normal file
|
@ -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.
|
Loading…
Reference in New Issue
Block a user