From 603fd75703984b9ba13ebf821713817164d602d3 Mon Sep 17 00:00:00 2001 From: Arnaud Locquet Date: Tue, 27 Oct 2020 17:40:42 +0100 Subject: [PATCH 1/8] fix: panic on small terminal when textinput for stash name is open --- src/components/select_branch.rs | 12 +++++++----- src/components/textinput.rs | 7 ++++++- src/ui/mod.rs | 26 ++++++++++++++++++++++---- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/components/select_branch.rs b/src/components/select_branch.rs index 4cc404b5da..f73558b5b5 100644 --- a/src/components/select_branch.rs +++ b/src/components/select_branch.rs @@ -23,6 +23,7 @@ use tui::{ Frame, }; +use crate::ui::Size; use anyhow::Result; use ui::style::SharedTheme; @@ -43,15 +44,16 @@ impl DrawableComponent for SelectBranchComponent { rect: Rect, ) -> Result<()> { if self.visible { - const PERCENT_SIZE: (u16, u16) = (60, 25); - const MIN_SIZE: (u16, u16) = (50, 20); + const PERCENT_SIZE: Size = Size::new(60, 25); + const MIN_SIZE: Size = Size::new(50, 20); let area = ui::centered_rect( - PERCENT_SIZE.0, - PERCENT_SIZE.1, + PERCENT_SIZE.width, + PERCENT_SIZE.height, f.size(), ); - let area = ui::rect_min(MIN_SIZE.0, MIN_SIZE.1, area); + let area = + ui::rect_inside(&MIN_SIZE, &f.size().into(), area); let area = area.intersection(rect); let scroll_threshold = area.height / 3; diff --git a/src/components/textinput.rs b/src/components/textinput.rs index 267c957887..c965e82621 100644 --- a/src/components/textinput.rs +++ b/src/components/textinput.rs @@ -1,3 +1,4 @@ +use crate::ui::Size; use crate::{ components::{ popup_paragraph, visibility_blocking, CommandBlocking, @@ -200,7 +201,11 @@ impl DrawableComponent for TextInputComponent { let area = match self.input_type { InputType::Multiline => { let area = ui::centered_rect(60, 20, f.size()); - ui::rect_min(10, 3, area) + ui::rect_inside( + &Size::new(10, 3), + &f.size().into(), + area, + ) } _ => ui::centered_rect_absolute(32, 3, f.size()), }; diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 606dad9855..3cba131e80 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -21,6 +21,24 @@ pub const fn calc_scroll_top( } } +/// ui component size representation +pub struct Size { + pub width: u16, + pub height: u16, +} + +impl Size { + pub const fn new(width: u16, height: u16) -> Self { + Self { width, height } + } +} + +impl Into for Rect { + fn into(self) -> Size { + Size::new(self.width, self.height) + } +} + /// use layouts to create a rects that /// centers inside `r` and sizes `percent_x`/`percent_x` of `r` pub fn centered_rect( @@ -53,10 +71,10 @@ pub fn centered_rect( .split(popup_layout[1])[1] } -/// makes sure Rect `r` at least stays as big as `width` & `height` -pub fn rect_min(width: u16, height: u16, r: Rect) -> Rect { - let new_width = r.width.max(width); - let new_height = r.height.max(height); +/// makes sure Rect `r` at least stays as big as min and not bigger than max +pub fn rect_inside(min: &Size, max: &Size, r: Rect) -> Rect { + let new_width = r.width.max(min.width).min(max.width); + let new_height = r.height.max(min.height).min(max.height); let diff_width = new_width.saturating_sub(r.width); let diff_height = new_height.saturating_sub(r.height); From 6df98ada7f40c5b1ad4f1676466a4fc6b6436177 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Wed, 28 Oct 2020 00:07:33 +0100 Subject: [PATCH 2/8] cleanup --- src/components/select_branch.rs | 2 +- src/components/textinput.rs | 4 ++-- src/ui/mod.rs | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/select_branch.rs b/src/components/select_branch.rs index f73558b5b5..cbc25db17c 100644 --- a/src/components/select_branch.rs +++ b/src/components/select_branch.rs @@ -53,7 +53,7 @@ impl DrawableComponent for SelectBranchComponent { f.size(), ); let area = - ui::rect_inside(&MIN_SIZE, &f.size().into(), area); + ui::rect_inside(MIN_SIZE, f.size().into(), area); let area = area.intersection(rect); let scroll_threshold = area.height / 3; diff --git a/src/components/textinput.rs b/src/components/textinput.rs index c965e82621..50c625751d 100644 --- a/src/components/textinput.rs +++ b/src/components/textinput.rs @@ -202,8 +202,8 @@ impl DrawableComponent for TextInputComponent { InputType::Multiline => { let area = ui::centered_rect(60, 20, f.size()); ui::rect_inside( - &Size::new(10, 3), - &f.size().into(), + Size::new(10, 3), + f.size().into(), area, ) } diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 3cba131e80..fa61d272b0 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -22,6 +22,7 @@ pub const fn calc_scroll_top( } /// ui component size representation +#[derive(Copy, Clone)] pub struct Size { pub width: u16, pub height: u16, @@ -72,7 +73,7 @@ pub fn centered_rect( } /// makes sure Rect `r` at least stays as big as min and not bigger than max -pub fn rect_inside(min: &Size, max: &Size, r: Rect) -> Rect { +pub fn rect_inside(min: Size, max: Size, r: Rect) -> Rect { let new_width = r.width.max(min.width).min(max.width); let new_height = r.height.max(min.height).min(max.height); let diff_width = new_width.saturating_sub(r.width); From d0f59fa0bff47b224fa8977feb63cf9413ecdd6d Mon Sep 17 00:00:00 2001 From: pm100 Date: Tue, 27 Oct 2020 16:14:50 -0700 Subject: [PATCH 3/8] Windows MSI - add display of file size (#373) --- .github/workflows/ci.yml | 3 ++- Makefile | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4427f787eb..5c17418caa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,8 @@ jobs: run: | cargo install cargo-wix cargo wix init - cargo wix --no-build --nocapture + cargo wix --no-build --nocapture --output ./target/wix/gitui.msi + ls -l ./target/wix/gitui.msi build-linux-musl: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 96d1420012..352fa95a8d 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,7 @@ release-win: build-release cargo install cargo-wix cargo wix init cargo wix --no-build --nocapture --output ./release/gitui.msi + ls -l ./release/gitui.msi release-linux-musl: build-linux-musl-release strip target/x86_64-unknown-linux-musl/release/gitui From 21b7513f4893dc74f1b93028a1a366a05ca7b8cd Mon Sep 17 00:00:00 2001 From: Florian Wilkens Date: Sat, 31 Oct 2020 12:26:30 +0100 Subject: [PATCH 4/8] Remove ui::style::ColorDef in favor up tui::style::Color (#391) Closes #149. --- Cargo.lock | 1 + Cargo.toml | 2 +- THEMES.md | 5 ++--- src/ui/style.rs | 55 +++++++++++++------------------------------------ 4 files changed, 18 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aecf0d4758..6e221fbb29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1282,6 +1282,7 @@ dependencies = [ "bitflags", "cassowary", "crossterm 0.17.7", + "serde", "unicode-segmentation", "unicode-width", ] diff --git a/Cargo.toml b/Cargo.toml index d346ca4010..e5107541e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ scopetime = { path = "./scopetime", version = "0.1" } asyncgit = { path = "./asyncgit", version = "0.10" } crossterm = { version = "0.18", features = [ "serde" ] } clap = { version = "2.33", default-features = false } -tui = { version = "0.12", default-features = false, features = ['crossterm'] } +tui = { version = "0.12", default-features = false, features = ['crossterm', 'serde'] } bytesize = { version = "1.0.1", default-features = false} itertools = "0.9" rayon-core = "1.9" diff --git a/THEMES.md b/THEMES.md index 872e56631f..99726144f2 100644 --- a/THEMES.md +++ b/THEMES.md @@ -1,4 +1,4 @@ -# Themes +# Themes default on light terminal: ![](assets/light-theme.png) @@ -10,5 +10,4 @@ to change the colors of the program you have to modify `theme.ron` file * `$XDG_CONFIG_HOME/gitui/theme.ron` (linux using XDG) * `$HOME/.config/gitui/theme.ron` (linux) -Valid colors can be found in [ColorDef](./src/ui/style.rs#ColorDef) struct. note that rgb colors might not be supported -in every terminal. +Valid colors can be found in tui-rs' [Color](https://docs.rs/tui/0.12.0/tui/style/enum.Color.html) struct. note that rgb colors might not be supported in every terminal. diff --git a/src/ui/style.rs b/src/ui/style.rs index 03e9917977..390c5767a9 100644 --- a/src/ui/style.rs +++ b/src/ui/style.rs @@ -18,35 +18,34 @@ pub type SharedTheme = Rc; #[derive(Serialize, Deserialize, Debug)] pub struct Theme { - #[serde(with = "ColorDef")] selected_tab: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] command_fg: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] selection_bg: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] cmdbar_extra_lines_bg: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] disabled_fg: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] diff_line_add: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] diff_line_delete: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] diff_file_added: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] diff_file_removed: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] diff_file_moved: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] diff_file_modified: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] commit_hash: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] commit_time: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] commit_author: Color, - #[serde(with = "ColorDef")] + #[serde(with = "Color")] danger_fg: Color, } @@ -266,29 +265,3 @@ impl Default for Theme { } } } - -/// we duplicate the Color definition from `tui` crate to implement Serde serialisation -/// this enum can be removed once [tui-#292](https://github.com/fdehau/tui-rs/issues/292) is resolved -#[derive(Serialize, Deserialize, Debug, Copy, Clone)] -#[serde(remote = "Color")] -enum ColorDef { - Reset, - Black, - Red, - Green, - Yellow, - Blue, - Magenta, - Cyan, - Gray, - DarkGray, - LightRed, - LightGreen, - LightYellow, - LightBlue, - LightMagenta, - LightCyan, - White, - Rgb(u8, u8, u8), - Indexed(u8), -} From 7e6e310ab842fa73c0682e3a8ce379f2bf52ed1b Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Sat, 31 Oct 2020 12:29:29 +0100 Subject: [PATCH 5/8] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67a224ef12..847b7b396a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - crash when changing git repo while gitui is open ([#271](https://github.com/extrawurst/gitui/issues/271)) +- remove workaround for color serialization [[@1wilkens](https://github.com/1wilkens)] ([#149](https://github.com/extrawurst/gitui/issues/149)) - crash on small terminal size ([#307](https://github.com/extrawurst/gitui/issues/307)) - fix vim keybindings uppercase handling [[@yanganto](https://github.com/yanganto)] ([#286](https://github.com/extrawurst/gitui/issues/286)) From bd00b3e4b8980968b9fbedbe1308079df9ffeda3 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Fri, 30 Oct 2020 02:34:23 +0100 Subject: [PATCH 6/8] fix scrollbar (#350) --- src/components/commit_details/details.rs | 3 +-- src/components/diff.rs | 2 +- src/ui/scrollbar.rs | 23 +++++++++++++---------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/commit_details/details.rs b/src/components/commit_details/details.rs index 6bcc66a01a..f11cd914b3 100644 --- a/src/components/commit_details/details.rs +++ b/src/components/commit_details/details.rs @@ -359,8 +359,7 @@ impl DrawableComponent for DetailsComponent { f, chunks[1], &self.theme, - self.get_number_of_lines(width as usize) - .saturating_sub(height as usize), + self.get_number_of_lines(width as usize), self.scroll_top.get(), ) } diff --git a/src/components/diff.rs b/src/components/diff.rs index d38c0eb35d..cf6e3a05f7 100644 --- a/src/components/diff.rs +++ b/src/components/diff.rs @@ -591,7 +591,7 @@ impl DrawableComponent for DiffComponent { r, &self.theme, self.lines_count(), - self.selection.get_end(), + self.scroll_top.get(), ); } diff --git a/src/ui/scrollbar.rs b/src/ui/scrollbar.rs index 673c3ceadf..5cd63bd472 100644 --- a/src/ui/scrollbar.rs +++ b/src/ui/scrollbar.rs @@ -12,16 +12,16 @@ use tui::{ /// struct Scrollbar { - max: u16, + lines: u16, pos: u16, style_bar: Style, style_pos: Style, } impl Scrollbar { - fn new(max: usize, pos: usize) -> Self { + fn new(lines: usize, pos: usize) -> Self { Self { - max: u16::try_from(max).unwrap_or_default(), + lines: u16::try_from(lines).unwrap_or_default(), pos: u16::try_from(pos).unwrap_or_default(), style_pos: Style::default(), style_bar: Style::default(), @@ -41,11 +41,11 @@ impl Widget for Scrollbar { vertical: 1, }); - if area.height < 4 { + if area.height == 0 { return; } - if area.height > self.max { + if area.height >= self.lines { return; } @@ -53,12 +53,15 @@ impl Widget for Scrollbar { buf.set_string(right, y, THICK_VERTICAL, self.style_bar); } - let progress = f32::from(self.pos) / f32::from(self.max); - let pos = f32::from(area.height.saturating_sub(1)) * progress; + let max_pos = self.lines.saturating_sub(area.height); + let progress = f32::from(self.pos) / f32::from(max_pos); + let progress = if progress > 1.0 { 1.0 } else { progress }; + let pos = f32::from(area.height) * progress; + //TODO: any better way for this? #[allow(clippy::cast_sign_loss)] #[allow(clippy::cast_possible_truncation)] - let pos = pos as u16; + let pos = (pos as u16).saturating_sub(1); buf.set_string(right, area.top() + pos, FULL, self.style_pos); } @@ -68,10 +71,10 @@ pub fn draw_scrollbar( f: &mut Frame, r: Rect, theme: &SharedTheme, - max: usize, + lines: usize, pos: usize, ) { - let mut widget = Scrollbar::new(max, pos); + let mut widget = Scrollbar::new(lines, pos); widget.style_pos = theme.scroll_bar_pos(); f.render_widget(widget, r) } From 7ba62b82df12734a810a682712257ecb613c1edb Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2020 11:27:56 +0000 Subject: [PATCH 7/8] Bump crossterm from 0.18.1 to 0.18.2 Bumps [crossterm](https://github.com/crossterm-rs/crossterm) from 0.18.1 to 0.18.2. - [Release notes](https://github.com/crossterm-rs/crossterm/releases) - [Changelog](https://github.com/crossterm-rs/crossterm/blob/master/CHANGELOG.md) - [Commits](https://github.com/crossterm-rs/crossterm/commits) Signed-off-by: dependabot-preview[bot] --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e221fbb29..c8237ec762 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -321,9 +321,9 @@ dependencies = [ [[package]] name = "crossterm" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cef9149b29071d44c9fb98fd9c27fcf74405bbdb761889ad6a03f36be93b0b15" +checksum = "4e86d73f2a0b407b5768d10a8c720cf5d2df49a9efc10ca09176d201ead4b7fb" dependencies = [ "bitflags", "crossterm_winapi", @@ -447,7 +447,7 @@ dependencies = [ "chrono", "clap", "crossbeam-channel", - "crossterm 0.18.1", + "crossterm 0.18.2", "dirs-next", "itertools", "log", From bbc0488d2216f17c979e29afc16062acce6d4e10 Mon Sep 17 00:00:00 2001 From: Richard Menzies <52405405+WizardOhio24@users.noreply.github.com> Date: Sat, 31 Oct 2020 11:44:51 +0000 Subject: [PATCH 8/8] Fix select branch list scrolling (#380) Closes #368 --- src/components/select_branch.rs | 176 ++++++++++++++++++-------------- 1 file changed, 99 insertions(+), 77 deletions(-) diff --git a/src/components/select_branch.rs b/src/components/select_branch.rs index cbc25db17c..d0f6984531 100644 --- a/src/components/select_branch.rs +++ b/src/components/select_branch.rs @@ -3,9 +3,11 @@ use super::{ DrawableComponent, }; use crate::{ + components::ScrollType, keys::SharedKeyConfig, queue::{Action, InternalEvent, NeedsUpdate, Queue}, - strings, ui, + strings, + ui::{self, calc_scroll_top}, }; use asyncgit::{ sync::{ @@ -14,7 +16,7 @@ use asyncgit::{ CWD, }; use crossterm::event::Event; -use std::{cmp, convert::TryFrom}; +use std::{cell::Cell, convert::TryInto}; use tui::{ backend::Backend, layout::{Alignment, Rect}, @@ -32,6 +34,7 @@ pub struct SelectBranchComponent { branch_names: Vec, visible: bool, selection: u16, + scroll_top: Cell, queue: Queue, theme: SharedTheme, key_config: SharedKeyConfig, @@ -56,22 +59,28 @@ impl DrawableComponent for SelectBranchComponent { ui::rect_inside(MIN_SIZE, f.size().into(), area); let area = area.intersection(rect); - let scroll_threshold = area.height / 3; - let scroll = - self.selection.saturating_sub(scroll_threshold); + let height_in_lines = + (area.height as usize).saturating_sub(2); + + self.scroll_top.set(calc_scroll_top( + self.scroll_top.get(), + height_in_lines, + self.selection as usize, + )); f.render_widget(Clear, area); f.render_widget( - Paragraph::new( - self.get_text(&self.theme, area.width)?, - ) + Paragraph::new(self.get_text( + &self.theme, + area.width, + height_in_lines, + )?) .block( Block::default() .title(strings::SELECT_BRANCH_POPUP_MSG) .borders(Borders::ALL) .border_type(BorderType::Thick), ) - .scroll((scroll, 0)) .alignment(Alignment::Left), area, ); @@ -135,9 +144,9 @@ impl Component for SelectBranchComponent { if e == self.key_config.exit_popup { self.hide() } else if e == self.key_config.move_down { - self.move_selection(true) + return self.move_selection(ScrollType::Up); } else if e == self.key_config.move_up { - self.move_selection(false) + return self.move_selection(ScrollType::Down); } else if e == self.key_config.enter { if let Err(e) = self.switch_to_selected_branch() { log::error!("switch branch error: {}", e); @@ -211,6 +220,7 @@ impl SelectBranchComponent { branch_names: Vec::new(), visible: false, selection: 0, + scroll_top: Cell::new(0), queue, theme, key_config, @@ -248,21 +258,23 @@ impl SelectBranchComponent { } /// - fn move_selection(&mut self, inc: bool) { - let mut new_selection = self.selection; - - new_selection = if inc { - new_selection.saturating_add(1) - } else { - new_selection.saturating_sub(1) + fn move_selection(&mut self, scroll: ScrollType) -> Result { + let num_branches: u16 = self.branch_names.len().try_into()?; + let num_branches = num_branches.saturating_sub(1); + + let mut new_selection = match scroll { + ScrollType::Up => self.selection.saturating_add(1), + ScrollType::Down => self.selection.saturating_sub(1), + _ => self.selection, }; - new_selection = cmp::max(new_selection, 0); - if let Ok(max) = - u16::try_from(self.branch_names.len().saturating_sub(1)) - { - self.selection = cmp::min(new_selection, max); + if new_selection > num_branches { + new_selection = num_branches; } + + self.selection = new_selection; + + Ok(true) } /// Get branches to display @@ -270,6 +282,7 @@ impl SelectBranchComponent { &self, theme: &SharedTheme, width_available: u16, + height: usize, ) -> Result { const COMMIT_HASH_LENGTH: usize = 8; const IS_HEAD_STAR_LENGTH: usize = 3; // "* " @@ -286,7 +299,12 @@ impl SelectBranchComponent { .saturating_sub(THREE_DOTS_LENGTH); let mut txt = Vec::new(); - for (i, displaybranch) in self.branch_names.iter().enumerate() + for (i, displaybranch) in self + .branch_names + .iter() + .skip(self.scroll_top.get()) + .take(height) + .enumerate() { let mut commit_message = displaybranch.top_commit_message.clone(); @@ -310,63 +328,67 @@ impl SelectBranchComponent { let is_head_str = if displaybranch.is_head { "*" } else { " " }; - txt.push(Spans::from(if self.selection as usize == i { - vec![ - Span::styled( - format!("{} ", is_head_str), - theme.commit_author(true), - ), - Span::styled( - format!( - ">{:w$} ", - branch_name, - w = branch_name_length + txt.push(Spans::from( + if self.selection as usize - self.scroll_top.get() + == i + { + vec![ + Span::styled( + format!("{} ", is_head_str), + theme.commit_author(true), + ), + Span::styled( + format!( + ">{:w$} ", + branch_name, + w = branch_name_length + ), + theme.commit_author(true), + ), + Span::styled( + format!( + "{} ", + displaybranch + .top_commit + .get_short_string() + ), + theme.commit_hash(true), ), - theme.commit_author(true), - ), - Span::styled( - format!( - "{} ", - displaybranch - .top_commit - .get_short_string() + Span::styled( + commit_message.to_string(), + theme.text(true, true), ), - theme.commit_hash(true), - ), - Span::styled( - commit_message.to_string(), - theme.text(true, true), - ), - ] - } else { - vec![ - Span::styled( - format!("{} ", is_head_str), - theme.commit_author(false), - ), - Span::styled( - format!( - " {:w$} ", - branch_name, - w = branch_name_length + ] + } else { + vec![ + Span::styled( + format!("{} ", is_head_str), + theme.commit_author(false), ), - theme.commit_author(false), - ), - Span::styled( - format!( - "{} ", - displaybranch - .top_commit - .get_short_string() + Span::styled( + format!( + " {:w$} ", + branch_name, + w = branch_name_length + ), + theme.commit_author(false), + ), + Span::styled( + format!( + "{} ", + displaybranch + .top_commit + .get_short_string() + ), + theme.commit_hash(false), ), - theme.commit_hash(false), - ), - Span::styled( - commit_message.to_string(), - theme.text(true, false), - ), - ] - })); + Span::styled( + commit_message.to_string(), + theme.text(true, false), + ), + ] + }, + )); } Ok(Text::from(txt))