diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | README | LICENSE

commit bb4051764c757fa0cf7ff4b3abe735b52c7889af
parent f8cf772f9a3cd91676038da929167577f31967e0
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Sun,  3 Jan 2021 23:51:04 +0100

Merge pull request #59 from in0rdr/first_last_entry

Fix #57: g/G for first/last entries
Diffstat:
MREADME.md | 4++--
Mdiary.1 | 4++--
Mdiary.c | 6++++--
3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md @@ -37,8 +37,8 @@ This is a text based diary, inspired by [khal](https://github.com/pimutils/khal) N go to the previous diary entry n go to the next diary entry - g go to the first date - G go to the last date + g go to the first journal entry + G go to the last journal entry J Go forward by 1 month K Go backward by 1 month diff --git a/diary.1 b/diary.1 @@ -50,8 +50,8 @@ q | quit the program N | go to the previous journal entry n | go to the next journal entry -g | go to the first date -G | go to the last date +g | go to the first journal entry +G | go to the last journal entry t | jump to today s | jump to specific day 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