Skip to content

Commit d11c297

Browse files
committed
Show bin-version in top area
Closes #19
1 parent 16d8080 commit d11c297

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/main.rs

+19-3
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ fn ui(f: &mut Frame, app: &App) {
482482
// If only output, then no top and fill all with output
483483
if let Mode::OnlyOutput = app.mode {
484484
let output_size = Fill(1);
485-
let vertical = Layout::vertical([Length(1), output_size, Length(3)]);
485+
let vertical = Layout::vertical([Length(2), output_size, Length(3)]);
486486
let [title_area, output, input] = vertical.areas(f.area());
487487

488488
draw_title_area(app, f, title_area);
@@ -494,7 +494,7 @@ fn ui(f: &mut Frame, app: &App) {
494494
// the rest will include the top
495495
let output_size = Length(SAVED_OUTPUT as u16);
496496

497-
let vertical = Layout::vertical([Length(1), top_size, output_size, Length(3)]);
497+
let vertical = Layout::vertical([Length(2), top_size, output_size, Length(3)]);
498498
let [title_area, top, output, input] = vertical.areas(f.area());
499499

500500
draw_title_area(app, f, title_area);
@@ -659,6 +659,22 @@ fn draw_asm(app: &App, f: &mut Frame, asm: Rect) {
659659
}
660660

661661
fn draw_title_area(app: &App, f: &mut Frame, title_area: Rect) {
662+
let vertical_title = Layout::vertical([Length(1), Length(1)]);
663+
let [first, second] = vertical_title.areas(title_area);
664+
f.render_widget(
665+
Block::new()
666+
.borders(Borders::TOP)
667+
.title(vec![
668+
"|".fg(Color::Rgb(100, 100, 100)),
669+
env!("CARGO_PKG_NAME").bold(),
670+
"-".fg(Color::Rgb(100, 100, 100)),
671+
"v".into(),
672+
env!("CARGO_PKG_VERSION").into(),
673+
"|".fg(Color::Rgb(100, 100, 100)),
674+
])
675+
.title_alignment(Alignment::Center),
676+
first,
677+
);
662678
// Title Area
663679
let (msg, style) = match app.input_mode {
664680
InputMode::Normal => (
@@ -694,7 +710,7 @@ fn draw_title_area(app: &App, f: &mut Frame, title_area: Rect) {
694710
};
695711
let text = Text::from(Line::from(msg)).style(style);
696712
let help_message = Paragraph::new(text);
697-
f.render_widget(help_message, title_area);
713+
f.render_widget(help_message, second);
698714
}
699715

700716
fn draw_stack(app: &App, f: &mut Frame, stack: Rect) {

0 commit comments

Comments
 (0)