Re: [[TIG][PATCH] 1/3] Add log_select function to find commit from context in log view

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 2, 2013 at 8:23 PM, Kumar Appaiah <a.kumar@xxxxxxxxxxxxxxxxx> wrote:
> diff --git a/tig.c b/tig.c
> index 72f132a..dd4b0f4 100644
> --- a/tig.c
> +++ b/tig.c
> @@ -4427,11 +4454,30 @@ log_open(struct view *view, enum open_flags flags)
>  static enum request
>  log_request(struct view *view, enum request request, struct line *line)
>  {
> +       struct log_state *state = (struct log_state *) view->private;
> +
>         switch (request) {
>         case REQ_REFRESH:
>                 load_refs();
>                 refresh_view(view);
>                 return REQ_NONE;
> +
> +       case REQ_MOVE_UP:
> +       case REQ_PREVIOUS:
> +               if (line->type == LINE_COMMIT && line->lineno > 1) {
> +                       /* We are at a commit, and heading upward. We
> +                          force log_select to find the previous
> +                          commit above, from the context. */
> +                       state->update_commit_ref = TRUE;
> +               }
> +               return pager_request(view, request, line);
> +
> +       case REQ_MOVE_PAGE_UP:
> +       case REQ_MOVE_PAGE_DOWN:
> +               /* We need to figure out the right commit again. */
> +               state->update_commit_ref = TRUE;
> +               return pager_request(view, request, line);
> +
>         default:
>                 return pager_request(view, request, line);
>         }

I forgot to mention there is one use case this doesn't currently
handle, namely jumping to a specific line using ':<number>'. Other
than detecting this by tracking the current line number in log_state I
haven't come up with a good way to detect that a recalculation is
required.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]