commit f1dd25ac020d649f81b6a0af03dca76aae57994e
parent f8cf772f9a3cd91676038da929167577f31967e0
Author: Oliver Blanthorn <freedom4cows@gmail.com>
Date: Fri, 1 Jan 2021 19:47:38 +0100
Fix #57: g/G for first/last entries
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/diary.c b/diary.c
@@ -506,10 +506,12 @@ int main(int argc, char** argv) {
// jump to top/bottom of page
case 'g':
- mv_valid = go_to(cal, aside, mktime(&cal_start), &pad_pos);
+ new_date = find_closest_entry(cal_start, false, diary_dir, diary_dir_size);
+ mv_valid = go_to(cal, aside, mktime(&new_date), &pad_pos);
break;
case 'G':
- mv_valid = go_to(cal, aside, mktime(&cal_end), &pad_pos);
+ new_date = find_closest_entry(cal_end, true, diary_dir, diary_dir_size);
+ mv_valid = go_to(cal, aside, mktime(&new_date), &pad_pos);
break;
// jump backward/forward by a month