keep cursor in the input window (#130)

This commit is contained in:
pdxlocations
2025-02-18 22:30:42 -08:00
committed by GitHub
parent 5dd06624e3
commit 8c837e68a0
+12 -4
View File
@@ -74,7 +74,6 @@ def handle_resize(stdscr, firstrun):
win.box()
win.refresh()
entry_win.keypad(True)
curses.curs_set(1)
@@ -90,13 +89,12 @@ def handle_resize(stdscr, firstrun):
def main_ui(stdscr):
global input_text
input_text = ""
stdscr.keypad(True)
get_channels()
handle_resize(stdscr, True)
input_text = ""
while True:
draw_text_field(entry_win, f"Input: {input_text[-(stdscr.getmaxyx()[1] - 10):]}", get_color("input"))
@@ -444,6 +442,11 @@ def draw_node_list():
refresh_pad(2)
# Restore cursor to input field
entry_win.move(1, len("Input: ") + len(input_text)+1)
entry_win.refresh()
curses.curs_set(1)
def select_channel(idx):
old_selected_channel = globals.selected_channel
globals.selected_channel = max(0, min(idx, len(globals.channel_list) - 1))
@@ -540,6 +543,11 @@ def draw_packetlog_win():
packetlog_win.box()
packetlog_win.refresh()
# Restore cursor to input field
entry_win.move(1, len("Input: ") + len(input_text)+1)
entry_win.refresh()
curses.curs_set(1)
def search(win):
start_idx = globals.selected_node
select_func = select_node