Fix todo viewing not working for large entries

Was not checking the length of the item when trying to add it to the
dropdown, causing failures.
This commit is contained in:
jude 2023-01-06 17:08:09 +00:00
parent 3150c7267d
commit d70fb24eb1

View File

@ -340,7 +340,18 @@ pub fn show_todo_page(
opt.create_option(|o| {
o.label(format!("Mark {} complete", count + first_num))
.value(id)
.description(disp.split_once(' ').unwrap_or(("", "")).1)
.description({
let c = disp.split_once(' ').unwrap_or(("", "")).1;
if c.len() > 100 {
format!(
"{}...",
c.chars().take(97).collect::<String>()
)
} else {
c.to_string()
}
})
});
}