feat(tui): scroll long names in every list and page through popups and chat
The sideways keys the results had (h/l, arrows, 0 and $) now scroll a transfer's file name and a query too, each list on its own. The browse tree and the room list take Home/End, PgUp/PgDn and the vim jumps like the main lists, and a chat log, room or private, pages back through its history and holds its place while new messages arrive; what arrives meanwhile counts as unread until the reader returns to the end.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::models::LogView;
|
||||
use chrono::{DateTime, Local};
|
||||
use soulseek_rs::types::{RoomEvent, RoomInfo};
|
||||
|
||||
@@ -38,6 +39,8 @@ pub struct OpenRoom {
|
||||
pub unread: usize,
|
||||
/// Per-room compose buffer.
|
||||
pub input: String,
|
||||
/// Where the log is being read.
|
||||
pub view: LogView,
|
||||
}
|
||||
|
||||
impl OpenRoom {
|
||||
@@ -160,6 +163,11 @@ impl RoomsState {
|
||||
.and_then(|r| r.users.get(self.user_selected).cloned())
|
||||
}
|
||||
|
||||
/// Where the active room's log is being read, to move it.
|
||||
pub fn active_view_mut(&mut self) -> Option<&mut LogView> {
|
||||
self.open.get_mut(self.active).map(|room| &mut room.view)
|
||||
}
|
||||
|
||||
pub const fn select_user_up(&mut self) {
|
||||
self.user_selected = self.user_selected.saturating_sub(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user