#1883 Show icon to jump to changed file from diff
Merged by pingou. Opened by cep.
cep/pagure feature_jump_to_file_from_diff  into  master

Download 1883.patch

When viewing a large diff in a PR, it can be helpful to see the
context of the changes. Display a small icon beside the diff's
changed lines, which when clicked will open the changed file (at
the relevant line number) in a new tab.

Implements ideas from https://pagure.io/pagure/issue/1753

What it looks like: https://paste.opensuse.org/view/simple/38571542

I found the eye icon most relevant, but it could be changed to something else if many of us feel differently. The icon is displayed only when hovering over the @@ -x,y +x,y @@ line in the diff.

Right now, this is implemented only for the PR page. Please point me to where else this needs to be added. We might also need to consider cases where the diff output is different. Since I'm fairly new, could someone please point out if there are any such cases?

Tests are still pending. I'll update them soon. Meanwhile, please suggest / correct :)

We already import flask above so there is no need for this one :)

You might want to use .partition() here to be safe (since you're not checking if this string is present in the line you're splitting)

I'm afraid including the color in there might make the split quite fragile :s

I agree, but I felt that was the most reliable way of making sure we weren't just confusing it for a line with the same text as the diff on it. What do you think we should have here?

Maybe just the last part? ; font-weight: bold"....

That ought to do it, I think, unless we make some changes in the html output. I'll change this.

2 new commits added

  • Add tests for 'open changed file' icon in PR diffs
  • Visual and logical improvements for 'jump to file from diff' feature

rebased

I applied the suggested changes, and made a couple of minor improvements. Can we have another round of review please?

rebased

Looks fine and works fine, let's rebase and merge :)

Since I have access to your fork, I did the rebase myself :)

rebased

Pull-Request has been merged by pingou

Metadata