Open with the last timesheet item selected

This commit is contained in:
FichteFoll 2021-12-06 18:55:54 +01:00
parent a7696f34cc
commit 00647c4ddb

View File

@ -72,9 +72,11 @@ fn effective_text(s: String) -> String {
impl TimeSheet {
pub fn open_or_create(path: &str) -> Self {
let times = read_times(path).unwrap_or_else(|| vec![TimePoint::new("start")]);
let selected = times.len().saturating_sub(1);
Self {
times: read_times(path).unwrap_or_else(|| vec![TimePoint::new("start")]),
selected: 0,
times,
selected,
register: None,
}
}