mirror of
https://github.com/pdxlocations/contact.git
synced 2026-08-10 02:42:46 +02:00
select last message when changing channels
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
'''
|
||||
Contact - A Console UI for Meshtastic by http://github.com/pdxlocations
|
||||
Powered by Meshtastic.org
|
||||
V 1.0.1
|
||||
V 1.0.3
|
||||
'''
|
||||
|
||||
import curses
|
||||
|
||||
+7
-2
@@ -103,8 +103,12 @@ def draw_messages_window():
|
||||
if max_messages < 1:
|
||||
max_messages = 1
|
||||
|
||||
# Calculate the scroll position based on the current selection
|
||||
# Set the initial scroll position to the bottom of the list
|
||||
max_scroll_position = max(0, num_messages - max_messages)
|
||||
|
||||
# if globals.selected_message is None or globals.selected_message == 0 or globals.selected_message >= num_messages:
|
||||
# globals.selected_message = num_messages - 1 # Default to the last message
|
||||
|
||||
start_index = max(0, min(globals.selected_message, max_scroll_position))
|
||||
|
||||
# Dynamically calculate max_messages based on visible messages and wraps
|
||||
@@ -142,7 +146,6 @@ def draw_messages_window():
|
||||
messages_win.refresh()
|
||||
draw_packetlog_win()
|
||||
|
||||
|
||||
def draw_node_list():
|
||||
|
||||
nodes_win.clear()
|
||||
@@ -169,6 +172,8 @@ def select_channels(direction):
|
||||
elif globals.selected_channel >= channel_list_length:
|
||||
globals.selected_channel = 0
|
||||
|
||||
globals.selected_message = len(globals.all_messages[globals.channel_list[globals.selected_channel]]) - 1
|
||||
|
||||
draw_channel_list()
|
||||
draw_messages_window()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user