summaryrefslogtreecommitdiffstats
path: root/src/layout.rs
diff options
context:
space:
mode:
authorkyoheiu <kyoheiu@outlook.com>2022-11-01 07:03:46 +0900
committerkyoheiu <kyoheiu@outlook.com>2022-11-01 07:03:46 +0900
commitfb8591eb9a8c055dd9fcbd213ed65bb07b04149b (patch)
tree7732afa0c30b297661ec44174f649c6adc5a6590 /src/layout.rs
parentc3a62de38bdec65e295accf3654110feea1fd1e4 (diff)
Remove use_full_width and item_name_length: Always use full width
Diffstat (limited to 'src/layout.rs')
-rw-r--r--src/layout.rs35
1 files changed, 3 insertions, 32 deletions
diff --git a/src/layout.rs b/src/layout.rs
index b452923..b70bd30 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -21,7 +21,6 @@ pub const CHAFA_WARNING: &str =
pub const PROPER_WIDTH: u16 = 28;
pub const TIME_WIDTH: u16 = 16;
-pub const DEFAULT_NAME_LENGTH: u16 = 30;
#[derive(Debug)]
pub struct Layout {
@@ -30,8 +29,6 @@ pub struct Layout {
pub terminal_column: u16,
pub name_max_len: usize,
pub time_start_pos: u16,
- pub use_full: Option<bool>,
- pub option_name_len: Option<usize>,
pub colors: ConfigColor,
pub preview: bool,
pub split: Split,
@@ -328,11 +325,7 @@ impl Layout {
}
/// Make app's layout according to terminal width and app's config.
-pub fn make_layout(
- column: u16,
- use_full: Option<bool>,
- name_length: Option<usize>,
-) -> (u16, usize) {
+pub fn make_layout(column: u16) -> (u16, usize) {
let mut time_start: u16;
let mut name_max: usize;
@@ -341,30 +334,8 @@ pub fn make_layout(
name_max = (column - 2).into();
(time_start, name_max)
} else {
- match use_full {
- Some(true) | None => {
- time_start = column - TIME_WIDTH;
- name_max = (time_start - SPACES).into();
- }
- Some(false) => match name_length {
- Some(option_max) => {
- time_start = option_max as u16 + SPACES;
- name_max = option_max;
- }
- None => {
- time_start = if column >= DEFAULT_NAME_LENGTH + TIME_WIDTH + SPACES {
- DEFAULT_NAME_LENGTH + SPACES
- } else {
- column - TIME_WIDTH
- };
- name_max = if column >= DEFAULT_NAME_LENGTH + TIME_WIDTH + SPACES {
- DEFAULT_NAME_LENGTH.into()
- } else {
- (time_start - SPACES).into()
- };
- }
- },
- }
+ time_start = column - TIME_WIDTH;
+ name_max = (time_start - SPACES).into();
let required = time_start + TIME_WIDTH - 1;
if required > column {
let diff = required - column;