Download raw body.
tog: tree view page up/down bugs
Stefan Sperling:
> Rebased diff. I've just comitted another trivial change which overlaps.
>
> diff 6e88edf0cbe9b44bb70c2b59d313aea6b5197a8e 19366d097e5368b7850c41aa2dfb2587054eb22e
> blob - 8442a98a5d8df651d1a68212c02dc9bb7284c585
> blob + 1e86a0b31d06f8b7654c3cf6f435d952ee57bb6b
> --- tog/tog.c
> +++ tog/tog.c
I can't get that one to misbehave. ok
You can also garbage-collect tree_scroll_up()'s "view" parameter.
Well.
I'm hesitant to give this sort of backseat commentary, but various
display-related functions in tog.c take an awful lot of parameters
that are actually redundant.
tree_scroll_up(struct tog_view *view,
struct got_tree_entry **first_displayed_entry, int maxscroll,
struct got_tree_object *tree, int isroot)
view is not used, but there is another way to see this if we look
at the caller:
tree_scroll_up(view, &s->first_displayed_entry, 1,
s->tree, s->tree == s->root);
tree_scroll_up(view, &s->first_displayed_entry,
MAX(0, view->nlines - 3), s->tree, s->tree == s->root);
The first_displayed_entry, tree, and isroot arguments are really
extracted from view, so this could also be refactored to
tree_scroll_up(struct tog_view *view, int maxscroll)
Now, tree_scroll_up() is a simple case, but there are things like
this:
err = draw_tree_entries(view, &s->first_displayed_entry,
&s->last_displayed_entry, &s->selected_entry,
&s->ndisplayed, s->tree_label, s->show_ids, parent_path,
s->tree, s->selected, view->nlines, s->tree == s->root,
&s->colors, s->repo);
At 14 arguments, that looks more like a compiler regression test
and could be simplified to draw_tree_entries(view, parent_path).
--
Christian "naddy" Weisgerber naddy@mips.inka.de
tog: tree view page up/down bugs