Skip to content

Commit 46c286a

Browse files
committed
Give more space to right-side diff view
1 parent cb17cfe commit 46c286a

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
* increase MSRV from 1.81 to 1.82 [[@cruessler](https://github.com/cruessler)]
1111

1212
### Added
13+
* Give more space to right-side diff view [[@hongquan](https://github.com/hongquan)] ([#2772](https://github.com/gitui-org/gitui/pull/2772))
1314
* Support pre-push hook [[@xlai89](https://github.com/xlai89)] ([#1933](https://github.com/extrawurst/gitui/issues/1933))
1415
* Message tab supports pageUp and pageDown [[@xlai89](https://github.com/xlai89)] ([#2623](https://github.com/extrawurst/gitui/issues/2623))
1516
* Files and status tab support pageUp and pageDown [[@fatpandac](https://github.com/fatpandac)] ([#1951](https://github.com/extrawurst/gitui/issues/1951))

src/popups/inspect_commit.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,29 +67,29 @@ pub struct InspectCommitPopup {
6767

6868
impl DrawableComponent for InspectCommitPopup {
6969
fn draw(&self, f: &mut Frame, rect: Rect) -> Result<()> {
70-
if self.is_visible() {
71-
let percentages = if self.diff.focused() {
72-
(0, 100)
73-
} else {
74-
(50, 50)
75-
};
76-
77-
let chunks = Layout::default()
78-
.direction(Direction::Horizontal)
79-
.constraints(
80-
[
81-
Constraint::Percentage(percentages.0),
82-
Constraint::Percentage(percentages.1),
83-
]
84-
.as_ref(),
85-
)
86-
.split(rect);
87-
88-
f.render_widget(Clear, rect);
89-
90-
self.details.draw(f, chunks[0])?;
91-
self.diff.draw(f, chunks[1])?;
70+
if !self.is_visible() {
71+
return Ok(());
9272
}
73+
let constraints = match rect.width {
74+
..80 => [
75+
Constraint::Percentage(50),
76+
Constraint::Percentage(50),
77+
],
78+
80..100 => [Constraint::Max(32), Constraint::Fill(1)],
79+
100..120 => [Constraint::Max(40), Constraint::Fill(1)],
80+
120..140 => [Constraint::Max(48), Constraint::Fill(1)],
81+
_ => [Constraint::Max(52), Constraint::Fill(1)],
82+
};
83+
84+
let chunks = Layout::default()
85+
.direction(Direction::Horizontal)
86+
.constraints(constraints)
87+
.split(rect);
88+
89+
f.render_widget(Clear, rect);
90+
91+
self.details.draw(f, chunks[0])?;
92+
self.diff.draw(f, chunks[1])?;
9393

9494
Ok(())
9595
}

0 commit comments

Comments
 (0)