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>,
|
f: &mut Frame<B>,
|
||||||
rect: Rect,
|
rect: Rect,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
if self.visible {
|
if self.is_visible() {
|
||||||
const PERCENT_SIZE: Size = Size::new(80, 50);
|
const PERCENT_SIZE: Size = Size::new(80, 50);
|
||||||
const MIN_SIZE: Size = Size::new(60, 20);
|
const MIN_SIZE: Size = Size::new(60, 20);
|
||||||
|
|
||||||
|
@ -218,21 +218,22 @@ impl DrawableComponent for RevisionFilesComponent {
|
|||||||
f: &mut Frame<B>,
|
f: &mut Frame<B>,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let chunks = Layout::default()
|
if self.is_visible() {
|
||||||
.direction(Direction::Horizontal)
|
let chunks = Layout::default()
|
||||||
.constraints(
|
.direction(Direction::Horizontal)
|
||||||
[
|
.constraints(
|
||||||
Constraint::Percentage(40),
|
[
|
||||||
Constraint::Percentage(60),
|
Constraint::Percentage(40),
|
||||||
]
|
Constraint::Percentage(60),
|
||||||
.as_ref(),
|
]
|
||||||
)
|
.as_ref(),
|
||||||
.split(area);
|
)
|
||||||
|
.split(area);
|
||||||
|
|
||||||
self.draw_tree(f, chunks[0]);
|
self.draw_tree(f, chunks[0]);
|
||||||
|
|
||||||
self.current_file.draw(f, chunks[1])?;
|
|
||||||
|
|
||||||
|
self.current_file.draw(f, chunks[1])?;
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,12 @@ impl VerticalScroll {
|
|||||||
);
|
);
|
||||||
self.top.set(new_top);
|
self.top.set(new_top);
|
||||||
|
|
||||||
let new_max = selection_max.saturating_sub(visual_height);
|
if visual_height == 0 {
|
||||||
self.max_top.set(new_max);
|
self.max_top.set(0);
|
||||||
|
} else {
|
||||||
|
let new_max = selection_max.saturating_sub(visual_height);
|
||||||
|
self.max_top.set(new_max);
|
||||||
|
}
|
||||||
|
|
||||||
new_top
|
new_top
|
||||||
}
|
}
|
||||||
@ -101,6 +105,9 @@ const fn calc_scroll_top(
|
|||||||
selection: usize,
|
selection: usize,
|
||||||
selection_max: usize,
|
selection_max: usize,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
|
if height_in_lines == 0 {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if selection_max <= height_in_lines {
|
if selection_max <= height_in_lines {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -123,4 +130,9 @@ mod tests {
|
|||||||
fn test_scroll_no_scroll_to_top() {
|
fn test_scroll_no_scroll_to_top() {
|
||||||
assert_eq!(calc_scroll_top(1, 10, 4, 4), 0);
|
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