Skip to content

Commit 9700f9f

Browse files
author
Stephan Dilly
committed
fix margin in file-tree
1 parent b8f8081 commit 9700f9f

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

src/components/revision_files.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,20 @@ impl RevisionFilesComponent {
194194

195195
let is_tree_focused = matches!(self.focus, Focus::Tree);
196196

197+
let title = format!(
198+
"Files at [{}]",
199+
self.revision
200+
.map(|c| c.get_short_string())
201+
.unwrap_or_default()
202+
);
197203
ui::draw_list_block(
198204
f,
199205
area,
200206
Block::default()
207+
.title(Span::styled(
208+
title,
209+
self.theme.title(is_tree_focused),
210+
))
201211
.borders(Borders::ALL)
202212
.border_style(self.theme.block(is_tree_focused)),
203213
items,
@@ -223,7 +233,6 @@ impl DrawableComponent for RevisionFilesComponent {
223233
) -> Result<()> {
224234
let chunks = Layout::default()
225235
.direction(Direction::Horizontal)
226-
.margin(1)
227236
.constraints(
228237
[
229238
Constraint::Percentage(40),

src/components/revision_files_popup.rs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,9 @@ use anyhow::Result;
1313
use asyncgit::{sync::CommitId, AsyncNotification};
1414
use crossbeam_channel::Sender;
1515
use crossterm::event::Event;
16-
use tui::{
17-
backend::Backend,
18-
layout::Rect,
19-
text::Span,
20-
widgets::{Block, Borders, Clear},
21-
Frame,
22-
};
16+
use tui::{backend::Backend, layout::Rect, widgets::Clear, Frame};
2317

2418
pub struct RevisionFilesPopup {
25-
title: String,
26-
theme: SharedTheme,
2719
visible: bool,
2820
key_config: SharedKeyConfig,
2921
files: RevisionFilesComponent,
@@ -38,14 +30,12 @@ impl RevisionFilesPopup {
3830
key_config: SharedKeyConfig,
3931
) -> Self {
4032
Self {
41-
title: String::new(),
4233
files: RevisionFilesComponent::new(
4334
queue,
4435
sender,
45-
theme.clone(),
36+
theme,
4637
key_config.clone(),
4738
),
48-
theme,
4939
visible: false,
5040
key_config,
5141
}
@@ -54,8 +44,6 @@ impl RevisionFilesPopup {
5444
///
5545
pub fn open(&mut self, commit: CommitId) -> Result<()> {
5646
self.files.set_commit(commit)?;
57-
self.title =
58-
format!("Files at [{}]", commit.get_short_string());
5947
self.show()?;
6048

6149
Ok(())
@@ -80,16 +68,16 @@ impl DrawableComponent for RevisionFilesPopup {
8068
) -> Result<()> {
8169
if self.is_visible() {
8270
f.render_widget(Clear, area);
83-
f.render_widget(
84-
Block::default()
85-
.borders(Borders::TOP)
86-
.title(Span::styled(
87-
format!(" {}", self.title),
88-
self.theme.title(true),
89-
))
90-
.border_style(self.theme.block(true)),
91-
area,
92-
);
71+
// f.render_widget(
72+
// Block::default()
73+
// .borders(Borders::TOP)
74+
// .title(Span::styled(
75+
// format!(" {}", self.title),
76+
// self.theme.title(true),
77+
// ))
78+
// .border_style(self.theme.block(true)),
79+
// area,
80+
// );
9381

9482
self.files.draw(f, area)?;
9583
}

0 commit comments

Comments
 (0)