mirror of
https://github.com/pdxlocations/contact.git
synced 2026-08-07 09:22:51 +02:00
closer changes
This commit is contained in:
@@ -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
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user