Compare commits

...

2 commits

2 changed files with 4 additions and 2 deletions

View file

@ -127,6 +127,7 @@ pub fn list(state: &mut State) {
let sessions = util::get_sessions().unwrap_or(Vec::new());
let search = state.target();
let previous = message(MSG_PREVIOUS);
// handle empty case
if sessions.len() == 0 {
@ -154,7 +155,7 @@ pub fn list(state: &mut State) {
let compare = Some(name.clone());
let marker =
if compare == state.title { current_symbol.clone() }
else if compare == message(MSG_PREVIOUS) { prev_symbol.clone() }
else if state.session && compare == previous { prev_symbol.clone() }
else { " ".to_string() };
println!(

View file

@ -26,7 +26,8 @@ pub fn message(fstr: &str) -> Option<String> {
if let Ok(output) = result {
let text = String::from_utf8(output.0.stdout);
if let Ok(title) = text {
Some(title[0..title.len() - 1].to_owned())
if title.len() > 0 { Some(title[0..title.len() - 1].to_owned()) }
else { None }
} else { None }
} else { None }
}