voelin-ui: open chats at the newest message, and jump to pins
Nothing set the position of the message list, so a chat opened at the oldest loaded message and new ones arrived out of sight below. The list now starts at its end and follows new messages while it is there; scrolling up stops that until the end is reached again, and another tab starts at its end. Jumping to a pinned message highlighted it but did not scroll: it now scrolls to the message (to where an average row would be, as the standard list estimates it, since rows differ in height) and leaves an open topic for the chat. The members panel could be dragged no wider than 420 px; it can now take what the window allows while the chat keeps 400 px. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No files matched your search
@@ -573,7 +573,18 @@ impl App {
|
||||
let Some(view) = self.view_mut() else { return };
|
||||
let tab = &mut view.tabs[view.current_tab];
|
||||
tab.marked = tab.pins.iter().find(|p| p.key == key).map(|p| p.message.id);
|
||||
// The message is in the chat, not in an open topic.
|
||||
if tab.topic.take().is_some() {
|
||||
tab.topic_messages.clear();
|
||||
}
|
||||
// Older than what is loaded: only highlighted once it is.
|
||||
let row = tab.marked.and_then(|id| tab.messages.iter().position(|m| m.message.id == id));
|
||||
self.refresh_chat();
|
||||
if let (Some(row), Some(ui)) = (row, self.ui.upgrade()) {
|
||||
let bridge = ui.global::<Bridge>();
|
||||
bridge.set_jump_index(row as i32);
|
||||
bridge.set_jump_requests(bridge.get_jump_requests().wrapping_add(1));
|
||||
}
|
||||
}
|
||||
|
||||
/// The topics drawer's search.
|
||||
|
||||
@@ -140,7 +140,8 @@ export component MainWindow inherits Window {
|
||||
if Nav.page == Page.server && root.side-panel: ResizeHandle {
|
||||
size <=> Nav.right-panel-width;
|
||||
minimum: Theme.right-panel-min;
|
||||
maximum: Theme.right-panel-max;
|
||||
// As wide as the window allows, leaving the chat 400 px.
|
||||
maximum: max(Theme.right-panel-min, root.width - Theme.rail-width - Theme.sidebar-width - 400px);
|
||||
left: false;
|
||||
}
|
||||
if Nav.page == Page.server && root.side-panel: Panel {
|
||||
|
||||
@@ -338,6 +338,10 @@ export global Bridge {
|
||||
in property <[ChatLine]> topic-messages;
|
||||
// The member card over the members panel.
|
||||
in-out property <MemberCard> member-card;
|
||||
// Jumping to a pinned message: its row in `messages`, and a counter
|
||||
// that changes with every jump.
|
||||
in property <int> jump-index: -1;
|
||||
in property <int> jump-requests;
|
||||
in property <string> status-text;
|
||||
// Unread messages in all chats of the current server.
|
||||
in property <int> unread-total;
|
||||
|
||||
@@ -377,10 +377,36 @@ export component MessageRow inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// The messages of the current chat (or of an open topic).
|
||||
// The messages of the current chat (or of an open topic). The list starts
|
||||
// at the newest message and follows new ones while it is at the end;
|
||||
// scrolling up stops that until the end is reached again.
|
||||
export component MessageList inherits VerticalLayout {
|
||||
in property <[ChatLine]> model;
|
||||
in property <bool> older;
|
||||
property <bool> follow: true;
|
||||
property <length> end: min(0px, list.visible-height - list.content-height);
|
||||
property <length> scrolled: list.content-y;
|
||||
changed end => {
|
||||
if root.follow {
|
||||
list.content-y = root.end;
|
||||
}
|
||||
}
|
||||
changed scrolled => { root.follow = root.scrolled <= root.end + 2px; }
|
||||
// Another chat: start at its end.
|
||||
property <int> tab: Bridge.current-tab;
|
||||
changed tab => {
|
||||
root.follow = true;
|
||||
list.content-y = root.end;
|
||||
}
|
||||
// A pinned message was jumped to: scroll to where its row is. Rows
|
||||
// differ in height, so this is the place of an average row (as the
|
||||
// standard list estimates it); the row itself is highlighted.
|
||||
property <int> jumps: Bridge.jump-requests;
|
||||
changed jumps => {
|
||||
if root.older && root.model.length > 0 {
|
||||
list.content-y = max(root.end, min(0px, list.visible-height / 3 - Bridge.jump-index * list.content-height / root.model.length));
|
||||
}
|
||||
}
|
||||
if Bridge.local-history: Rectangle {
|
||||
height: 30px;
|
||||
background: Theme.warning-soft;
|
||||
@@ -415,7 +441,7 @@ export component MessageList inherits VerticalLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
list := ListView {
|
||||
vertical-stretch: 1;
|
||||
// A long chat must not make the window taller: the list scrolls.
|
||||
preferred-height: 0px;
|
||||
|
||||
@@ -136,7 +136,6 @@ export global Theme {
|
||||
out property <length> sidebar-width: 264px * max(1.0, font-scale);
|
||||
out property <length> topbar-height: 56px;
|
||||
out property <length> right-panel-min: 220px;
|
||||
out property <length> right-panel-max: 420px;
|
||||
|
||||
// Motion.
|
||||
out property <duration> fast: 120ms;
|
||||
|
||||
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |