From d4123990fc6cfa274262cbdb5fa32ff6864ae4df Mon Sep 17 00:00:00 2001 From: lol-cubes Date: Sun, 24 Nov 2019 19:06:14 -0500 Subject: [PATCH] fix deletions when cursor not at end of line --- cl_timer/graphics.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cl_timer/graphics.py b/cl_timer/graphics.py index b72eba6..418e184 100644 --- a/cl_timer/graphics.py +++ b/cl_timer/graphics.py @@ -157,11 +157,13 @@ def _del_char(self): Removes last char from input field """ if self.cursor_index > self.prompt_length: - # change appearance - self.chars[self.cursor_index] = Char(self.cursor_index, 0, ' ') - # change value - self.inputted_chars = self.inputted_chars[:-1] + self.inputted_chars.pop(self.cursor_index - self.prompt_length - 1) + + # change appearance + self.chars = Char.fromstring( + self.prompt + ''.join(self.inputted_chars) + ''.join( + [' ' for _ in range(len(self.canvas.grid[-1]) - (self.prompt_length + len(self.inputted_chars)))])) self.cursor_index -= 1