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:
@ -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()
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user