commit 068ab281f5df14cf0424c2640219bab16fd43a15 from: Mark Jamsek via: Thomas Adam date: Fri Jul 01 21:18:25 2022 UTC tog: fix C-d and G log view keymaps in horizontal split Account for the border so we don't scroll offscreen, and don't unset the load_all flag till all commits have been loaded so we take the correct path in log_move_cursor_down(). ok stsp@ commit - e44940c3e5135c640a6eccb2a5ebe054b4759909 commit + 068ab281f5df14cf0424c2640219bab16fd43a15 blob - 99961153450c2ceb7edca3f2f34cd031e2c19d6e blob + bf2ce6767499b8f4137c5fddb3fbbd66174a8885 --- tog/tog.c +++ tog/tog.c @@ -2823,7 +2823,7 @@ log_move_cursor_down(struct tog_view *view, int page) ++s->selected; else err = log_scroll_down(view, 1); - } else if (s->thread_args.log_complete) { + } else if (s->thread_args.load_all) { if (s->last_displayed_entry->idx == s->commits.ncommits - 1) s->selected += MIN(s->last_displayed_entry->idx - s->selected_entry->idx, page + 1); @@ -2906,17 +2906,23 @@ input_log_view(struct tog_view **new_view, struct tog_ struct tog_view *diff_view = NULL, *tree_view = NULL; struct tog_view *ref_view = NULL; struct commit_queue_entry *entry; - int begin_x = 0, begin_y = 0, n, nscroll = view->nlines - 1; + int begin_x = 0, begin_y = 0, eos, n, nscroll; if (s->thread_args.load_all) { if (ch == KEY_BACKSPACE) s->thread_args.load_all = 0; else if (s->thread_args.log_complete) { - s->thread_args.load_all = 0; err = log_move_cursor_down(view, s->commits.ncommits); + s->thread_args.load_all = 0; } return err; } + + eos = nscroll = view->nlines - 1; + if (view->mode == TOG_VIEW_SPLIT_HRZN && view->child && + view_is_splitscreen(view->child)) + --eos; /* border */ + switch (ch) { case 'q': @@ -2982,7 +2988,7 @@ input_log_view(struct tog_view **new_view, struct tog_ s->selected = 0; entry = TAILQ_LAST(&s->commits.head, commit_queue_head); - for (n = 0; n < view->nlines - 1; n++) { + for (n = 0; n < eos; n++) { if (entry == NULL) break; s->first_displayed_entry = entry;