git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jonas Fonseca <fonseca@diku.dk>
Date
Aug 6, 2013, 03:54 UTC
Message-ID
<CAFuPQ1+5O+dBCjHYu2soAtNKiNxofAuWSVEeKBj=yu+kRGggCw@mail.gmail.com>
In-Reply-To
<1375489399-11618-2-git-send-email-a.kumar@alumni.iitm.ac.in>
On Fri, Aug 2, 2013 at 8:23 PM, Kumar Appaiah <a.kumar@alumni.iitm.ac.in> wrote:
Show 35 quoted lines
> 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.

Previous: Kumar AppaiahNext: Kumar Appaiah
Message 5 of 9 in “Refactoring of the log view”
  1. Kumar AppaiahAug 3, 2013
  2. [[TIG][PATCH] 1/3] Add log_select function to find commit from context in log viewKumar Appaiah, Aug 3, 2013
  3. Jonas FonsecaAug 6, 2013
  4. Kumar AppaiahAug 6, 2013
  5. Jonas FonsecaAug 6, 2013
  6. [[TIG][PATCH] 2/3] Display correct diff the context in split log viewKumar Appaiah, Aug 3, 2013
  7. Jonas FonsecaAug 6, 2013
  8. [[TIG][PATCH] 3/3] Revert "Scroll diff with arrow keys in log view"Kumar Appaiah, Aug 3, 2013
  9. Jonas FonsecaAug 6, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.