From 384e36dac25cd005f9a6756fd541c6e6e56a3430 Mon Sep 17 00:00:00 2001 From: Russell Schmidt Date: Thu, 12 Jun 2025 17:23:03 -0500 Subject: [PATCH] Only clear input on enter when sending message We should only clear the input field when the user presses enter if the user actually sent the message. If selecting a different node to send to, don't clear input. --- contact/ui/contact_ui.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contact/ui/contact_ui.py b/contact/ui/contact_ui.py index a10d289..21c2ebe 100644 --- a/contact/ui/contact_ui.py +++ b/contact/ui/contact_ui.py @@ -137,8 +137,7 @@ def main_ui(stdscr: curses.window) -> None: handle_leftright(char) elif char in (chr(curses.KEY_ENTER), chr(10), chr(13)): - handle_enter(input_text) - input_text = "" + input_text = handle_enter(input_text) elif char == chr(20): # Ctrl + t for Traceroute handle_ctrl_t(stdscr) @@ -318,6 +317,7 @@ def handle_enter(input_text: str) -> None: draw_node_list() draw_channel_list() draw_messages_window(True) + return input_text elif len(input_text) > 0: # Enter key pressed, send user input as message @@ -325,8 +325,8 @@ def handle_enter(input_text: str) -> None: draw_messages_window(True) # Clear entry window and reset input text - input_text = "" entry_win.erase() + return "" def handle_ctrl_t(stdscr: curses.window) -> None: