From 4455781e6c8a79fcb5d40c69d6679d2aed2a75d5 Mon Sep 17 00:00:00 2001 From: pdxlocations Date: Thu, 12 Jun 2025 16:38:05 -0700 Subject: [PATCH] fix types and returns --- contact/ui/contact_ui.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contact/ui/contact_ui.py b/contact/ui/contact_ui.py index 21c2ebe..e8fa589 100644 --- a/contact/ui/contact_ui.py +++ b/contact/ui/contact_ui.py @@ -108,7 +108,7 @@ def main_ui(stdscr: curses.window) -> None: handle_resize(stdscr, True) while True: - draw_text_field(entry_win, f"Input: {input_text[-(stdscr.getmaxyx()[1] - 10):]}", get_color("input")) + draw_text_field(entry_win, f"Input: {(input_text or '')[-(stdscr.getmaxyx()[1] - 10):]}", get_color("input")) # Get user input from entry window char = entry_win.get_wch() @@ -297,7 +297,7 @@ def handle_leftright(char: int) -> None: refresh_pad(2) -def handle_enter(input_text: str) -> None: +def handle_enter(input_text: str) -> str: """Handle Enter key events to send messages or select channels.""" if ui_state.current_window == 2: node_list = ui_state.node_list @@ -327,6 +327,7 @@ def handle_enter(input_text: str) -> None: # Clear entry window and reset input text entry_win.erase() return "" + return input_text def handle_ctrl_t(stdscr: curses.window) -> None: @@ -342,7 +343,7 @@ def handle_ctrl_t(stdscr: curses.window) -> None: handle_resize(stdscr, False) -def handle_backspace(entry_win: curses.window, input_text: str) -> None: +def handle_backspace(entry_win: curses.window, input_text: str) -> str: """Handle backspace key events to remove the last character from input text.""" if input_text: input_text = input_text[:-1]