commit 2525dccb913c5e7f293cfcad103af7a761d32b34 from: Mark Jamsek date: Wed Jul 13 11:27:56 2022 UTC tog: fix sticky "loading..." status in log view hsplit Don't request commits if the log has completed loading all commits. While here, ensure the correct parent/child view requests commits when resizing a hsplit. Reported by stsp: $ tog S # switch into hsplit mode G # move to bottom and load all commits Enter # open a diff showing the initial import commit - # shrink the diff view by one line; alternatively use + to grow it *log status stuck with "loading..." in the header* ok stsp@ commit - 1bd8e3b16ccbc427fca485fda6db88babc57dc2b commit + 2525dccb913c5e7f293cfcad103af7a761d32b34 blob - 2a08545196a8a55276ca860ed3c40e5d659d2134 blob + 41a38da73b3c99dd62ddda5ae9e19708dea2b862 --- tog/tog.c +++ tog/tog.c @@ -987,8 +987,10 @@ view_resize_split(struct tog_view *view, int resize) if (err) return err; v->child->resized_y = v->child->begin_y; - if (y > v->child->begin_y) /* split increased */ + if (y > v->child->begin_y && v->child->type == TOG_VIEW_LOG) v->child->nscrolled = y - v->child->begin_y; + else if (y < v->child->begin_y && v->type == TOG_VIEW_LOG) + v->nscrolled = v->child->begin_y - y; } else { if (v->child->resized_x) v->child->begin_x = v->child->resized_x; @@ -1024,9 +1026,9 @@ view_resize_split(struct tog_view *view, int resize) return err; } - if (v->type == TOG_VIEW_LOG && v->nscrolled) + if (v->nscrolled) err = request_log_commits(v); - else if (v->child->type == TOG_VIEW_LOG && v->child->nscrolled) + else if (v->child->nscrolled) err = request_log_commits(v->child); v->resize = v->child->resize = 0; @@ -2401,6 +2403,9 @@ request_log_commits(struct tog_view *view) { struct tog_log_view_state *state = &view->state.log; const struct got_error *err = NULL; + + if (state->thread_args.log_complete) + return NULL; state->thread_args.commits_needed += view->nscrolled; err = trigger_log_thread(view, 1); @@ -2446,7 +2451,7 @@ log_scroll_down(struct tog_view *view, int maxscroll) s->first_displayed_entry = pentry; } while (++nscrolled < maxscroll); - if (view->mode == TOG_VIEW_SPLIT_HRZN) + if (view->mode == TOG_VIEW_SPLIT_HRZN && !s->thread_args.log_complete) view->nscrolled += nscrolled; else view->nscrolled = 0;