Skip to content

Commit

Permalink
fix problems with arrow key movement in inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
lol-cubes committed Nov 24, 2019
1 parent f96afee commit 1c1c2ea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cl_timer/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def type_char(self, char):
new_char = chr(char) # converts int ascii code to get string for inputted char

# replace current char in cursor location with new char
self.inputted_chars.insert(self.cursor_index - 2, new_char)
self.inputted_chars.insert(self.cursor_index - self.prompt_length, new_char)
self.cursor_index += 1

self.chars = Char.fromstring(
Expand All @@ -197,10 +197,11 @@ def type_char(self, char):
self.render()

elif char == 260:
self.cursor_index -= 1
if (self.cursor_index - self.prompt_length - 1) >= 0:
self.cursor_index -= 1

elif char == 261:
if (self.prompt_length + len(self.inputted_chars)) > (self.cursor_index + 1):
if (self.prompt_length + len(self.inputted_chars)) >= (self.cursor_index + 1):
self.cursor_index += 1


Expand Down

0 comments on commit 1c1c2ea

Please sign in to comment.