1 CharacterDeleter
VetheonGames edited this page 2023-06-08 11:32:39 -06:00

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.