Compare commits

...

4 Commits

Author SHA1 Message Date
JEEVITHA KANNAN K S
3f73626abb
Merge 5944d8443b into 79eb752552 2024-10-09 06:11:46 +05:30
JEEVITHA KANNAN K S
5944d8443b
Update tui/src/state.rs
Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com>
2024-10-01 13:10:35 +05:30
JEEVITHA KANNAN K S
cc16c3e56d
Use string instead of box::leak 2024-10-01 12:11:45 +05:30
JEEVITHA KANNAN K S
6c2aaf339f
Add spacing 2024-09-30 22:48:03 +05:30
3 changed files with 10 additions and 10 deletions

View File

@ -74,7 +74,7 @@ impl FloatContent for RunningCommand {
title_line.push_span(
Span::default()
.content(" press <ENTER> to close this window ")
.content(" Press <ENTER> to close this window ")
.style(Style::default()),
);

View File

@ -24,7 +24,7 @@ use temp_dir::TempDir;
const MIN_WIDTH: u16 = 77;
const MIN_HEIGHT: u16 = 19;
const TITLE: &str = concat!("Linux Toolbox - ", env!("BUILD_DATE"));
const TITLE: &str = concat!(" Linux Toolbox - ", env!("BUILD_DATE"), " ");
const ACTIONS_GUIDE: &str = "List of important tasks performed by commands' names:
D - disk modifications (ex. partitioning) (privileged)
@ -61,7 +61,7 @@ pub struct AppState {
selected_commands: Vec<Rc<ListNode>>,
drawable: bool,
#[cfg(feature = "tips")]
tip: &'static str,
tip: String,
}
pub enum Focus {
@ -371,7 +371,7 @@ impl AppState {
};
#[cfg(feature = "tips")]
let bottom_title = Line::from(self.tip.bold().blue()).right_aligned();
let bottom_title = Line::from(self.tip.as_str().bold().blue()).right_aligned();
#[cfg(not(feature = "tips"))]
let bottom_title = "";
@ -742,13 +742,13 @@ impl AppState {
const TIPS: &str = include_str!("../cool_tips.txt");
#[cfg(feature = "tips")]
fn get_random_tip() -> &'static str {
fn get_random_tip() -> String {
let tips: Vec<&str> = TIPS.lines().collect();
if tips.is_empty() {
return "";
return "".to_string();
}
let mut rng = rand::thread_rng();
let random_index = rng.gen_range(0..tips.len());
tips[random_index]
format!(" {} ", tips[random_index])
}