Try to fix navigation with search_mode=True

This commit is contained in:
Digital Studium 2024-04-08 22:55:23 +03:00
parent f70a072482
commit 9921116d68
1 changed files with 15 additions and 6 deletions

21
kls
View File

@ -121,12 +121,21 @@ def main(stdscr):
if key_pressed == "/": if key_pressed == "/":
search_mode = True search_mode = True
if search_mode: if search_mode:
if key_pressed == "KEY_BACKSPACE": match key_pressed:
if search_string: case '\t' | "KEY_RIGHT":
search_string = search_string[:-1] current_menu = navigate_horizontally("right", current_menu)
else: case "KEY_BTAB" | "KEY_LEFT":
search_mode = False current_menu = navigate_horizontally("left", current_menu)
elif key_pressed.isalpha() or key_pressed == "-": case "KEY_DOWN":
navigate_vertically("down", current_menu)
case "KEY_UP":
navigate_vertically("up", current_menu)
case "KEY_BACKSPACE":
if search_string:
search_string = search_string[:-1]
else:
search_mode = False
if key_pressed.isalpha() or key_pressed == "-":
search_string += key_pressed search_string += key_pressed
elif key_pressed == "/" and search_string == "": elif key_pressed == "/" and search_string == "":
pass pass