#263 small
Kelan Champagne

Pressing 'v' multiple times in history detail view shows multiple flie lists.

Reported by Kelan Champagne | September 11th, 2010 @ 10:40 AM | in 0.8

When a commit's diff is longer than 200k characters, it show the "This is a large commit." message, and instructs the user to click a link or press 'v' to view the full diff. However, the user can press 'v' multiple times (even on a "short" commit) to invoke the showDiff() function, and it will add another copy of the file list to the current view. See attached screenshot, where looked at a commit, and pressed 'v' multiple times.

Expect:
Either the keyboard listener should ignore 'v' when it's not valid (i.e. for a short diff, or after it's already been pressed on a long diff), or the showDiff() function should abort gracefully if it's already been run. I assume the latter approach would be easier.

Comments and changes to this ticket

  • Johannes Gilger

    Johannes Gilger September 11th, 2010 @ 07:16 PM

    • Milestone set to 0.8
    • State changed from “new” to “small”
    • Assigned user changed from “Pieter de Bie” to “Johannes Gilger”
    • Milestone order changed from “32831” to “0”

    I can confirm this in Nathan's experimental is. The problem is that the list of files is appended, while the actual diff is redrawn when 'showDiff' is called.

    I wrote a one-liner which simply clears the list of files as well, so 'v' acts as refresh-button for the diff. This is the easiest way to get desired behavior. Having an extra-variable for checking whether 'v' was already pressed seems overly complicated to me.

    Will queue it for 0.8.

  • Kelan Champagne

    Kelan Champagne September 11th, 2010 @ 07:48 PM

    Yeah, I made a simple fix locally too. It aborts from highlightDiff() if it's already been run, which it determines based on the .className of the target element. In order for this to work, also reset the .className of the "diff" div at the top of loadCommit().

    Here is the diff:

    diff --git a/html/lib/diffHighlighter.js b/html/lib/diffHighlighter.js
    index cda95a8..f18e0e1 100644
    --- a/html/lib/diffHighlighter.js
    +++ b/html/lib/diffHighlighter.js
    @@ -10,6 +10,10 @@ var highlightDiff = function(diff, element, callbacks) {
        if (!diff || diff == "")
            return;
    
    +   // Don't run twice.
    +   if (element.className == "diff")
    +       return;
    +
        if (!callbacks)
            callbacks = {};
        var start = new Date().getTime();
    diff --git a/html/views/history/history.js b/html/views/history/history.js
    index 6cd7540..ca34cf4 100644
    --- a/html/views/history/history.js
    +++ b/html/views/history/history.js
    @@ -179,6 +179,7 @@ var loadCommit = function(commitObject, currentRef) {
        $("authorID").innerHTML = commit.author_name;
        $("subjectID").innerHTML = commit.subject.escapeHTML();
        $("diff").innerHTML = ""
    +   $("diff").className = "";
        $("message").innerHTML = ""
        $("files").innerHTML = ""
        $("date").innerHTML = ""
    
  • Quentin0

    Quentin0 June 14th, 2018 @ 09:55 AM

    I think the main issue is that the rundown of records is affixed, while the genuine diff is redrawn when 'showDiff' is called. I composed a joke which essentially clears the rundown of documents too, so 'v' goes about as invigorate catch for the diff. This is the least demanding approach to get wanted conduct. Having an additional variable for checking whether 'v' was at that point squeezed appears to be excessively convoluted to me. However, I want best dissertation editing services but this website is good for the students to learn a lot of things.

  • annashetty

    annashetty June 15th, 2018 @ 08:55 AM

    • Tag set to driving directions

    This is the most impressive article on your site, thanks for constantly working on replenishing the material
    driving directions

  • umesh

    umesh June 15th, 2018 @ 09:38 AM

    MC Donald’s is the famous largest fast food restaurant in the world. It was founded as McDonald’s on 15th May 1940 that was 78 years ago in San Bernardino, California.

    mcdonalds app |
    mcd app

  • tarozexika

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

GitX is the nice-looking gitk clone for OS X

Attachments

Pages