Skip to content

Commit

Permalink
fix deletions when cursor not at end of line
Browse files Browse the repository at this point in the history
  • Loading branch information
lol-cubes committed Nov 25, 2019
1 parent 1c1c2ea commit d412399
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cl_timer/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d412399

Please sign in to comment.