remove shortened_text mode from status-bar

This commit is contained in:
Kunal Mohan 2021-05-25 13:20:30 +05:30
parent c60abe6ad6
commit 151deb3235
2 changed files with 1 additions and 47 deletions

View File

@ -43,17 +43,6 @@ impl CtrlKeyShortcut {
CtrlKeyAction::Session => String::from("SESSION"),
}
}
pub fn shortened_text(&self) -> String {
match self.action {
CtrlKeyAction::Lock => String::from("LOCK"),
CtrlKeyAction::Pane => String::from("ane"),
CtrlKeyAction::Tab => String::from("ab"),
CtrlKeyAction::Resize => String::from("esize"),
CtrlKeyAction::Scroll => String::from("croll"),
CtrlKeyAction::Quit => String::from("uit"),
CtrlKeyAction::Session => String::from("sess"),
}
}
pub fn letter_shortcut(&self) -> char {
match self.action {
CtrlKeyAction::Lock => 'g',
@ -197,32 +186,6 @@ fn full_ctrl_key(key: &CtrlKeyShortcut, palette: ColoredElements, separator: &st
}
}
fn shortened_ctrl_key(
key: &CtrlKeyShortcut,
palette: ColoredElements,
separator: &str,
) -> LinePart {
let shortened_text = key.shortened_text();
let letter_shortcut = key.letter_shortcut();
let shortened_text = match key.action {
CtrlKeyAction::Lock => format!(" {}", shortened_text),
_ => shortened_text,
};
match key.mode {
CtrlKeyMode::Unselected => {
unselected_mode_shortcut(letter_shortcut, &shortened_text, palette, separator)
}
CtrlKeyMode::Selected => {
selected_mode_shortcut(letter_shortcut, &shortened_text, palette, separator)
}
CtrlKeyMode::Disabled => disabled_mode_shortcut(
&format!(" <{}>{}", letter_shortcut, shortened_text),
palette,
separator,
),
}
}
fn single_letter_ctrl_key(
key: &CtrlKeyShortcut,
palette: ColoredElements,
@ -258,15 +221,6 @@ fn key_indicators(
return line_part;
}
line_part = LinePart::default();
for ctrl_key in keys {
let key = shortened_ctrl_key(ctrl_key, palette, separator);
line_part.part = format!("{}{}", line_part.part, key.part);
line_part.len += key.len;
}
if line_part.len < max_len {
return line_part;
}
line_part = LinePart::default();
for ctrl_key in keys {
let key = single_letter_ctrl_key(ctrl_key, palette, separator);
line_part.part = format!("{}{}", line_part.part, key.part);

View File

@ -265,7 +265,7 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
}
ServerInstruction::Render(output) => {
if *session_state.read().unwrap() == SessionState::Attached {
// Here output is of type Option<String> sent by screen thread.
// Here output is of the type Option<String> sent by screen thread.
// If `Some(_)`- unwrap it and forward it to the client to render.
// If `None`- Send an exit instruction. This is the case when the user closes last Tab/Pane.
if let Some(op) = output {