Don't always render list cursor
This commit is contained in:
parent
a03971c019
commit
9f9f68466a
3 changed files with 11 additions and 4 deletions
|
|
@ -189,7 +189,14 @@ impl<Id: Clone + Eq> List<Id> {
|
|||
self.clamp_scrolling(height, rows.len());
|
||||
}
|
||||
|
||||
pub fn render(&mut self, frame: &mut Frame, pos: Pos, size: Size, rows: Vec<Row<Id>>) {
|
||||
pub fn render(
|
||||
&mut self,
|
||||
frame: &mut Frame,
|
||||
pos: Pos,
|
||||
size: Size,
|
||||
rows: Vec<Row<Id>>,
|
||||
focus: bool,
|
||||
) {
|
||||
self.stabilize(size.height as usize, &rows);
|
||||
|
||||
for (i, row) in rows.into_iter().enumerate() {
|
||||
|
|
@ -208,7 +215,7 @@ impl<Id: Clone + Eq> List<Id> {
|
|||
selected,
|
||||
selected_bg,
|
||||
} => {
|
||||
let (fg, bg) = if self.cursor() == Some(&id) {
|
||||
let (fg, bg) = if focus && self.cursor() == Some(&id) {
|
||||
(selected, selected_bg)
|
||||
} else {
|
||||
(normal, normal_bg)
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ impl EuphRoom {
|
|||
}
|
||||
|
||||
let rows = Self::render_rows(joined);
|
||||
self.nick_list.render(frame, pos, size, rows);
|
||||
self.nick_list.render(frame, pos, size, rows, false);
|
||||
}
|
||||
|
||||
fn render_hsplit(frame: &mut Frame, hsplit: i32) {
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ impl Rooms {
|
|||
async fn render_rooms(&mut self, frame: &mut Frame) {
|
||||
let rooms = self.stabilize_rooms().await;
|
||||
let rows = self.render_rows(rooms).await;
|
||||
self.list.render(frame, Pos::ZERO, frame.size(), rows);
|
||||
self.list.render(frame, Pos::ZERO, frame.size(), rows, true);
|
||||
}
|
||||
|
||||
pub async fn handle_key_event(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue