closer changes

This commit is contained in:
pdxlocations
2025-05-17 22:33:44 -07:00
parent 6d45788a5b
commit 3d305a22b9
2 changed files with 22 additions and 11 deletions
+9 -7
View File
@@ -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)
+13 -4
View File
@@ -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: