From 31528c5c9d2a8a3acd082bb9c98671fae9164514 Mon Sep 17 00:00:00 2001 From: VetheonGames <76892542+VetheonGames@users.noreply.github.com> Date: Thu, 8 Jun 2023 11:32:39 -0600 Subject: [PATCH] Created CharacterDeleter (markdown) --- CharacterDeleter.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 CharacterDeleter.md 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.