Change default widths (#506)

This commit is contained in:
Denis Isidoro 2021-04-15 09:24:45 -03:00 committed by GitHub
parent 1c9ffde3ec
commit d5d939bc96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,8 +22,8 @@ lazy_static! {
pub static ref TAG_COLOR: Color = parse_ansi(env_var::TAG_COLOR, Color::Cyan); pub static ref TAG_COLOR: Color = parse_ansi(env_var::TAG_COLOR, Color::Cyan);
pub static ref COMMENT_COLOR: Color = parse_ansi(env_var::COMMENT_COLOR, Color::Blue); pub static ref COMMENT_COLOR: Color = parse_ansi(env_var::COMMENT_COLOR, Color::Blue);
pub static ref SNIPPET_COLOR: Color = parse_ansi(env_var::SNIPPET_COLOR, Color::White); pub static ref SNIPPET_COLOR: Color = parse_ansi(env_var::SNIPPET_COLOR, Color::White);
pub static ref TAG_WIDTH_PERCENTAGE: u16 = env_var::parse(env_var::TAG_WIDTH).unwrap_or(27); pub static ref TAG_WIDTH_PERCENTAGE: u16 = env_var::parse(env_var::TAG_WIDTH).unwrap_or(26);
pub static ref COMMENT_WIDTH_PERCENTAGE: u16 = env_var::parse(env_var::COMMENT_WIDTH).unwrap_or(43); pub static ref COMMENT_WIDTH_PERCENTAGE: u16 = env_var::parse(env_var::COMMENT_WIDTH).unwrap_or(42);
} }
pub fn preview(comment: &str, tags: &str, snippet: &str) { pub fn preview(comment: &str, tags: &str, snippet: &str) {
@ -124,7 +124,7 @@ fn limit_str(text: &str, length: usize) -> String {
fn get_widths() -> (usize, usize) { fn get_widths() -> (usize, usize) {
let width = terminal::width(); let width = terminal::width();
let tag_width = max(20, width * *TAG_WIDTH_PERCENTAGE / 100); let tag_width = max(20, width * *TAG_WIDTH_PERCENTAGE / 100);
let comment_width = max(60, width * *COMMENT_WIDTH_PERCENTAGE / 100); let comment_width = max(45, width * *COMMENT_WIDTH_PERCENTAGE / 100);
(usize::from(tag_width), usize::from(comment_width)) (usize::from(tag_width), usize::from(comment_width))
} }