Download raw body.
[fix] tog: G and C-d keymaps in hsplit
I noticed a bug in the log handler where we fail to account for the border in hsplits, and a related logic error with G scrolling, which breaks C-d and G after an initial G scroll. repro: case #1 $ TOG_VIEW_SPLIT_MODE=h tog return # open commit in split tab # switch focus to log G # jump to end g # jump home d # scroll 1/2 page down -> scrolls full page and cursor is offscreen case #2 $ TOG_VIEW_SPLIT_MODE=h tog return # open commit in split tab # switch focus to log in top split G # jump to end g # jump home G # jump to end -> selection cursor is offscreen The fix is simple enough, account for the border in hsplit, and don't unset thread_args.load_all till after we call log_move_cursor_down(). diff 9b058f456d15d60a89334ce3e7f0a7c22e182c55 /Users/mark/Library/Mobile Documents/com~apple~CloudDocs/src/got-current blob - 6a0c6dbff39ee1a8db173cbc3fa1fbf0918eecab file + tog/tog.c --- tog/tog.c +++ tog/tog.c @@ -2810,7 +2810,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); @@ -2893,18 +2893,24 @@ 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': s->quit = 1; @@ -2969,7 +2975,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; -- Mark Jamsek <fnc.bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
[fix] tog: G and C-d keymaps in hsplit