Skip to content

Commit

Permalink
small readability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mecaneer23 committed Oct 1, 2023
1 parent 88ec950 commit 274034d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/get_todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,15 @@ def handle_delete(win: Any, chars: list[str], position: int) -> tuple[list[str],
def handle_ctrl_arrow(
win: Any, chars: list[str], position: int
) -> tuple[list[str], int]:
for _ in range(2): # skip the `;5`
for _ in ";5":
win.getch()
options = {
67: ("right arrow", handle_ctrl_right_arrow),
68: ("left arrow", handle_ctrl_left_arrow),
}
direction = win.getch()
if direction == 67: # right arrow
chars, position = handle_ctrl_right_arrow(chars, position)
elif direction == 68: # left arrow
chars, position = handle_ctrl_left_arrow(chars, position)
if direction in options:
chars, position = options[direction][1](chars, position)
return chars, position


Expand Down

0 comments on commit 274034d

Please sign in to comment.