Skip to content

Commit

Permalink
Turing off chat border has correct vertical margins
Browse files Browse the repository at this point in the history
  • Loading branch information
Xithrius committed May 18, 2024
1 parent eba2756 commit 028f148
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/ui/components/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ impl ChatWidget {

let mut messages = VecDeque::new();

let general_chunk_height = area.height as usize - 2;
let mut general_chunk_height = area.height as usize;
if !self.config.borrow().frontend.hide_chat_border {
general_chunk_height -= 2;
}

let mut scroll = self.scroll_offset.get_offset();

Expand Down Expand Up @@ -228,18 +231,17 @@ impl Component for ChatWidget {
final_messages.push(ListItem::new(Text::from(item)));
}

let list = List::new(final_messages)
.block(
if self.config.borrow().frontend.hide_chat_border {
Block::default()
} else {
Block::default()
.borders(Borders::ALL)
.border_type(self.config.borrow().frontend.border_type.clone().into())
}
.title(chat_title),
let list = if self.config.borrow().frontend.hide_chat_border {
List::new(final_messages)
} else {
List::new(final_messages).block(
Block::default()
.borders(Borders::ALL)
.border_type(self.config.borrow().frontend.border_type.clone().into())
.title(chat_title),
)
.style(Style::default().fg(Color::White));
}
.style(Style::default().fg(Color::White));

f.render_widget(list, *first_v_chunk);

Expand Down

0 comments on commit 028f148

Please sign in to comment.