Download raw body.
tog log in hsplit stuck with loading...
On 22-07-12 10:43pm, Stefan Sperling wrote: > In tog, it is possible to get the log view into a state where the status > shown in the top line of this view will always say 'loading...' instead > of showing the usual stuff like reference names, even after all commits > have already been loaded. > > To reproduce this in got.git, do: > > $ 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 > > Now the log view says 'loading...' and this never seems to go away. > > I don't have a fix for this myself. I would be happy to test a fix. > I might eventually find time to look into it myself, but not right now. The below diff fixes this issue. The problem is we call request_log_commits() if we've either scrolled n lines or the split is resized to ensure we have enough commits to populate the view when a fullscreen is restored (e.g., via 'F' or 'q') or as the split increases, and increment commits_needed accordingly. However, when all commits are already loaded, this makes commits_needed permanently > 0, which results in the stuck "loading..." status. In this case, we were incrementing view->nscrolled in log_scroll_down() from the 'G' key map, so when resizing the split we call request_log_commits() needlessly as all commits are already loaded. The fix is to _not_ increment view->nscrolled if all commits have already been loaded. While debugging this, however, I noticed we could increment view->nscrolled on the wrong view in view_resize_split(), so the diff also fixes this. And for robustness adds a check for the log_complete flag in request_log_commits() and bails early if set. diff /Users/mark/Library/Mobile Documents/com~apple~CloudDocs/src/got-current commit - 1bd8e3b16ccbc427fca485fda6db88babc57dc2b path + /Users/mark/Library/Mobile Documents/com~apple~CloudDocs/src/got-current blob - 2a08545196a8a55276ca860ed3c40e5d659d2134 file + tog/tog.c --- 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; @@ -2402,6 +2404,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); view->nscrolled = 0; @@ -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; -- Mark Jamsek <fnc.bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
tog log in hsplit stuck with loading...