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 { impl TimeSheet {
pub fn open_or_create(path: &str) -> Self { 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 { Self {
times: read_times(path).unwrap_or_else(|| vec![TimePoint::new("start")]), times,
selected: 0, selected,
register: None, register: None,
} }
} }