mirror of
https://github.com/extrawurst/gitui.git
synced 2024-12-28 11:32:16 +03:00
fix commit msg details lockin (#780)
This commit is contained in:
parent
3bdb1d3a1a
commit
5e62217928
@ -51,7 +51,7 @@ impl DrawableComponent for BranchListComponent {
|
||||
f: &mut Frame<B>,
|
||||
rect: Rect,
|
||||
) -> Result<()> {
|
||||
if self.visible {
|
||||
if self.is_visible() {
|
||||
const PERCENT_SIZE: Size = Size::new(80, 50);
|
||||
const MIN_SIZE: Size = Size::new(60, 20);
|
||||
|
||||
|
@ -218,6 +218,7 @@ impl DrawableComponent for RevisionFilesComponent {
|
||||
f: &mut Frame<B>,
|
||||
area: Rect,
|
||||
) -> Result<()> {
|
||||
if self.is_visible() {
|
||||
let chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints(
|
||||
@ -232,7 +233,7 @@ impl DrawableComponent for RevisionFilesComponent {
|
||||
self.draw_tree(f, chunks[0]);
|
||||
|
||||
self.current_file.draw(f, chunks[1])?;
|
||||
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -65,8 +65,12 @@ impl VerticalScroll {
|
||||
);
|
||||
self.top.set(new_top);
|
||||
|
||||
if visual_height == 0 {
|
||||
self.max_top.set(0);
|
||||
} else {
|
||||
let new_max = selection_max.saturating_sub(visual_height);
|
||||
self.max_top.set(new_max);
|
||||
}
|
||||
|
||||
new_top
|
||||
}
|
||||
@ -101,6 +105,9 @@ const fn calc_scroll_top(
|
||||
selection: usize,
|
||||
selection_max: usize,
|
||||
) -> usize {
|
||||
if height_in_lines == 0 {
|
||||
return 0;
|
||||
}
|
||||
if selection_max <= height_in_lines {
|
||||
return 0;
|
||||
}
|
||||
@ -123,4 +130,9 @@ mod tests {
|
||||
fn test_scroll_no_scroll_to_top() {
|
||||
assert_eq!(calc_scroll_top(1, 10, 4, 4), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_scroll_zero_height() {
|
||||
assert_eq!(calc_scroll_top(4, 0, 4, 3), 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user