commit fe731b51aaf9031ee68b950393f97f9654bee63f from: Mark Jamsek via: Thomas Adam date: Thu Jul 14 00:07:31 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 - 3cb9337907f257b2eb23c58f951d0a39407eebe8 commit + fe731b51aaf9031ee68b950393f97f9654bee63f blob - 073f1d8a7443c9dbbc3b80a2ce3214102db001ba blob + e0a3db5cbdda7afb9b8796c9939174b50df46a46 --- tog/tog.c +++ tog/tog.c @@ -991,8 +991,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; @@ -1028,9 +1030,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; @@ -2405,6 +2407,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); @@ -2450,7 +2455,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;