git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Cc: git <git@vger.kernel.org>
Subject: Re: [[TIG][PATCH] 2/3] Display correct diff the context in split log view
Date: Mon, 5 Aug 2013 23:50:05 -0400	[thread overview]
Message-ID: <CAFuPQ1JbX77=KdzFnPXYH5+=2+E1mxS+r8C1VsXYkpYJfMG7_A@mail.gmail.com> (raw)
In-Reply-To: <1375489399-11618-3-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:
> In the log view, when scrolling across a commit, the diff view should
> automatically switch to the commit whose context the cursor is on in
> the log view. This commit changes things to catch the REQ_ENTER in the
> log view and handle recalculation of the commit and diff display from
> log_request, rather than delegating it to pager_request. In addition,
> it also gets rid of unexpected upward scrolling of the log view.
>
> Fixes GH #155
>
> Signed-Off-By: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
> ---
>  NEWS  |  1 +
>  tig.c | 12 ++++++++++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index 0394407..f59e517 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -46,6 +46,7 @@ Bug fixes:
>   - Fix rendering glitch for branch names.
>   - Do not apply diff styling to untracked files in the stage view. (GH #153)
>   - Fix tree indentation for entries containing combining characters. (GH #170)
> + - Introduce a more natural context-sensitive log display. (GH #155)
>
>  tig-1.1
>  -------
> diff --git a/tig.c b/tig.c
> index dd4b0f4..53947b7 100644
> --- a/tig.c
> +++ b/tig.c
> @@ -4478,6 +4478,18 @@ log_request(struct view *view, enum request request, struct line *line)
>                 state->update_commit_ref = TRUE;
>                 return pager_request(view, request, line);
>
> +       case REQ_ENTER:
> +               /* Recalculate the correct commit for the context. */

See my dislike for this type of comments. ;)

> +               state->update_commit_ref = TRUE;
> +
> +               open_view(view, REQ_VIEW_DIFF, OPEN_SPLIT);

This is called every time the user presses up/down. There should be a
check that compares the VIEW(REQ_VIEW_DIFF)->ref to ref_commit.

> +               update_view_title(view);

This can be deleted. pager_request require this hack due to the
automatic scrolling (if I recall correctly).

> +
> +               /* We don't want to delegate this to pager_request,
> +                  since we don't want the extra scrolling of the log
> +                  view. */

This explanation should IMO go into the commit message and not a
comment since it is somewhat confusing unless you are familiar with
the previous behaviour.

> +               return REQ_NONE;
> +
>         default:
>                 return pager_request(view, request, line);

This line can be changed to `return request;`

>         }
> --
> 1.8.3.2
>

-- 
Jonas Fonseca

  reply	other threads:[~2013-08-06  3:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-03  0:23 [TIG][PATCH 0/3] Refactoring of the log view Kumar Appaiah
2013-08-03  0:23 ` [[TIG][PATCH] 1/3] Add log_select function to find commit from context in " Kumar Appaiah
2013-08-06  3:27   ` Jonas Fonseca
2013-08-06  4:08     ` Kumar Appaiah
2013-08-06  3:54   ` Jonas Fonseca
2013-08-03  0:23 ` [[TIG][PATCH] 2/3] Display correct diff the context in split " Kumar Appaiah
2013-08-06  3:50   ` Jonas Fonseca [this message]
2013-08-03  0:23 ` [[TIG][PATCH] 3/3] Revert "Scroll diff with arrow keys in log view" Kumar Appaiah
2013-08-06  4:00 ` [TIG][PATCH 0/3] Refactoring of the log view Jonas Fonseca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFuPQ1JbX77=KdzFnPXYH5+=2+E1mxS+r8C1VsXYkpYJfMG7_A@mail.gmail.com' \
    --to=fonseca@diku.dk \
    --cc=a.kumar@alumni.iitm.ac.in \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).