From 3d305a22b96f9cee9da5952881affa5397347506 Mon Sep 17 00:00:00 2001 From: pdxlocations Date: Sat, 17 May 2025 22:33:44 -0700 Subject: [PATCH] closer changes --- contact/ui/contact_ui.py | 16 +++++++++------- contact/ui/nav_utils.py | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/contact/ui/contact_ui.py b/contact/ui/contact_ui.py index bbdad17..e387940 100644 --- a/contact/ui/contact_ui.py +++ b/contact/ui/contact_ui.py @@ -506,14 +506,16 @@ def draw_messages_window(scroll_to_bottom: bool = False) -> None: messages_win.attrset(get_color("window_frame")) messages_win.refresh() - if scroll_to_bottom: - ui_state.selected_message = max(msg_line_count - get_msg_window_lines(messages_win, packetlog_win), 0) - else: - ui_state.selected_message = max( - min(ui_state.selected_message, msg_line_count - get_msg_window_lines(messages_win, packetlog_win)), 0 - ) + visible_lines = get_msg_window_lines(messages_win, packetlog_win) - draw_main_arrows(messages_win, msg_line_count - 1, ui_state.start_index, ui_state.current_window) + if scroll_to_bottom: + ui_state.selected_message = max(msg_line_count - visible_lines, 0) + ui_state.start_index[1] = max(msg_line_count - visible_lines, 0) + pass + else: + ui_state.selected_message = max(min(ui_state.selected_message, msg_line_count - visible_lines), 0) + + draw_main_arrows(messages_win, msg_line_count, ui_state.start_index, ui_state.current_window, window=messages_win) messages_win.refresh() refresh_pad(1) diff --git a/contact/ui/nav_utils.py b/contact/ui/nav_utils.py index 79ee23b..59f5f85 100644 --- a/contact/ui/nav_utils.py +++ b/contact/ui/nav_utils.py @@ -385,14 +385,20 @@ def highlight_line( ) -def draw_main_arrows(win: object, max_index: int, start_index: List[int], current_window: int) -> None: +def draw_main_arrows(win: object, max_index: int, start_index: List[int], current_window: int, **kwargs) -> None: height, width = win.getmaxyx() usable_height = height - 2 usable_width = width - 2 - if current_window == 1 and ui_state.display_log: - usable_height -= 1 + # if (packetlog_win := kwargs.get("window")) and ui_state.current_window == 1: + # usable_height -= packetlog_win.getmaxyx()[0] - 1 if ui_state.display_log else 0 + + # if current_window == 1 and ui_state.display_log: + # usable_height -= 1 + + # if current_window == 1: + # usable_height -= 2 if height < max_index: if start_index[current_window] > 0: @@ -400,10 +406,13 @@ def draw_main_arrows(win: object, max_index: int, start_index: List[int], curren else: win.addstr(1, usable_width, " ", get_color("settings_default")) - if max_index - start_index[current_window] >= usable_height + 1: + if max_index - start_index[current_window] - 1 >= usable_height: win.addstr(usable_height, usable_width, "▼", get_color("settings_default")) else: win.addstr(usable_height, usable_width, " ", get_color("settings_default")) + else: + win.addstr(1, usable_width, " ", get_color("settings_default")) + win.addstr(usable_height, usable_width, " ", get_color("settings_default")) def get_msg_window_lines(messages_win, packetlog_win) -> None: