Skip to content

Commit

Permalink
Adding text wrapping to the output section of the configure page
Browse files Browse the repository at this point in the history
  • Loading branch information
bjohnson5 committed Sep 30, 2024
1 parent de8636b commit f92abcf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions blast_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ simplelog = "0.12.2"
log = "0.4.20"
ratatui = "0.27.0"
anyhow = { version = "1.0.69", features = ["backtrace"] }
textwrap = "0.14"
16 changes: 13 additions & 3 deletions blast_cli/src/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use ratatui::{
widgets::*,
};

use textwrap;

use crate::shared::*;

#[derive(PartialEq,Clone)]
Expand Down Expand Up @@ -168,9 +170,17 @@ impl BlastTab for ConfigureTab {
}
_ => {}
}

let messages: Vec<ListItem> = self
.messages

let mut out: Vec<String> = Vec::new();
let width: usize = messages_area.width.into();
for s in &self.messages {
let wrapped_text = textwrap::wrap(s, width);
for line in wrapped_text {
out.push(line.to_string());
}
}

let messages: Vec<ListItem> = out
.iter()
.enumerate()
.map(|(_, m)| {
Expand Down

0 comments on commit f92abcf

Please sign in to comment.