aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tui/ui.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/tui/ui.rs b/src/tui/ui.rs
index 4878848..0f552f2 100644
--- a/src/tui/ui.rs
+++ b/src/tui/ui.rs
@@ -88,23 +88,32 @@ fn draw_chat_log(f: &mut Frame, area: Rect, state: &AppState) {
.iter()
.map(|msg| render_chat_line(msg))
.collect();
-
let block = Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Plain)
.border_style(Style::default().fg(Color::Green))
.style(Style::default());
-
let inner_width = area.width.saturating_sub(2) as usize;
let inner_height = area.height.saturating_sub(2) as usize;
-
let total_wrapped = count_wrapped_lines(&lines, inner_width);
- let scroll = total_wrapped.saturating_sub(inner_height);
+
+ let (padded_lines, scroll) = if total_wrapped < inner_height {
+ // Pad the top with empty lines to push content to the bottom
+ let padding = inner_height - total_wrapped;
+ let mut padded = vec![Line::raw(""); padding];
+ padded.extend(lines);
+ (padded, 0u16)
+ } else {
+ // Content overflows — scroll to keep the latest lines visible
+ let scroll = total_wrapped.saturating_sub(inner_height);
+ (lines, scroll as u16)
+ };
+
f.render_widget(
- Paragraph::new(Text::from(lines))
+ Paragraph::new(Text::from(padded_lines))
.block(block)
.wrap(Wrap { trim: false })
- .scroll((scroll as u16, 0)),
+ .scroll((scroll, 0)),
area,
);
}
='logmsg'> 2010-09-09Adding nibbles patchGravatar Enno Boland (tox) 1-16/+14 2010-09-02fix for segfault when closing window while loading (via nibble)Gravatar pancake 1-13/+16 2010-06-25using ctrl-f to find.Gravatar Enno Boland (tox) 1-1/+1 2010-06-08Added tag 0.4.1 for changeset 71388899ac09Gravatar Enno Boland (tox) 1-0/+1 2010-06-08next will be 0.4.1Gravatar Enno Boland (tox) 1-1/+1 2010-06-03reverting sessiontimeGravatar Enno Boland (tox) 1-1/+1 2010-05-30Added tag 0.4 for changeset ac8e058003edGravatar Enno Boland (tox) 1-0/+1 2010-05-28Adding Nibbles patchGravatar Enno Boland (tox) 2-14/+8 2010-05-26typoGravatar Enno Boland (tox) 1-2/+2 2010-05-26Applying Nibbles download patch. Thanks!Gravatar Enno Boland (tox) 2-0/+20 2010-05-25changing user agent string as suggested by Marvin VekGravatar Enno Boland (tox) 1-1/+1 2010-05-24removing spatial navigation.Gravatar Enno Boland (tox) 1-1/+0 2010-05-24implementing downloading.Gravatar Enno Boland (tox) 1-1/+9 2010-05-24enabling spatial-navigationGravatar Enno Boland (tox) 1-0/+1 2010-05-18AtomHiLight is set correctly for links.Gravatar Enno Boland (tox) 1-1/+21 2010-05-17changing xpropsGravatar Enno Boland (tox) 2-32/+35 2010-05-17dl is not needed anymoreGravatar Enno Boland (tox) 2-4/+1 2010-05-17removing context-menu, downloading.Gravatar Enno Boland (tox) 2-122/+8 2010-05-15changing sessiontime to 3600Gravatar Enno Boland (tox) 1-1/+1 2010-05-11fix download/history bugGravatar Enno Boland (tox) 1-5/+0 2010-05-09Fix NOBACKGROUND meaningGravatar pancake 2-2/+2 2010-05-09changing default value of NOBACKGROUNDGravatar Enno Boland (tox) 1-1/+1 2010-05-09added js-fix by Troels Henriksen. Thanks :)Gravatar Enno Boland (tox) 1-9/+17 2010-05-08Do not set cookie session time if set to 0Gravatar pancake 2-2/+5 Add NOBACKGROUND config.def.h option - requires body {background-color} in style.css - fixes white background when loading pages 2010-05-06implementing naive file locking.Gravatar Enno Boland (tox) 1-0/+7 2010-05-06fixing compilerwarning in newer webkit versionsGravatar Enno Boland (tox) 1-2/+1 2010-05-06fixing config.mkGravatar Enno Boland (tox) 1-1/+1 2010-05-02Adding small fix by Alex Puterbaugh. Thanks.Gravatar Enno Boland (tox) 2-7/+6 2010-04-08remove empty linesGravatar pancake 1-3/+1 2010-03-29whoops... linking OoGravatar Enno Boland (tox) 1-3/+3 2010-03-26typofix.Gravatar Enno Boland (tox) 2-5/+5 2010-03-25reimplementing cookies. Now we need some file locking.Gravatar Enno Boland (tox) 1-2/+14 2010-03-25updating manpage, reformating help output.Gravatar Enno Boland (tox) 2-9/+19 2010-03-24fixing argument parsing.Gravatar Enno Boland (tox) 1-0/+2 2010-03-24fixing downloadsGravatar Enno Boland (tox) 1-8/+6 2010-03-24gotheaders will now be called correctly.Gravatar Enno Boland (tox) 1-1/+6