1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-10-03 18:27:14 +03:00

fix(tui): fix the scrolling

This commit is contained in:
Orhun Parmaksız 2024-10-02 00:07:30 +03:00
parent e7c9bd1f96
commit 65327c0aed
No known key found for this signature in database
GPG Key ID: F83424824B3E4B90

View File

@ -220,12 +220,16 @@ fn render_changelog(state: &mut State, frame: &mut Frame, rect: Rect) {
rect,
);
if let Some(component) = &mut state.markdown.component {
component.set_scroll(state.markdown.scroll_index);
let mut height = 2;
for child in component.children() {
if let Component::TextComponent(c) = child {
let mut c = c.clone();
c.set_y_offset(c.y_offset() + 2);
frame.render_widget(c.clone(), state.markdown.area);
c.set_scroll_offset(state.markdown.scroll_index);
c.set_y_offset(height);
height += c.height();
if c.height() + c.scroll_offset() + 1 < height {
frame.render_widget(c.clone(), state.markdown.area);
}
}
}
frame.render_stateful_widget(