Skip to content

Add no-useless-split-diff-view feature - #4399

Merged
fregante merged 20 commits into
refined-github:mainfrom
cheap-glitch:add-hide-empty-split-diff-side
Jun 11, 2021
Merged

fregante merged 20 commits into
refined-github:mainfrom
cheap-glitch:add-hide-empty-split-diff-side

Conversation

@cheap-glitch

@cheap-glitch cheap-glitch commented May 25, 2021 •

Copy link
Copy Markdown
Contributor

Closes #4397

Test URLs

Screenshot

New files

Before:
image

After:
image

Modified files

Before:
image

After:
image

Demo screenshot

hide-empty-split-diff-side

@fregante

Copy link
Copy Markdown
Member

Can you include a screenshot of how it looks in files that aren't completely new? Like the readme.md in this PR

@cheap-glitch

This comment has been minimized.

Co-authored-by: Federico Brigante <[email protected]>
@fregante

Copy link
Copy Markdown
Member

Keep in mind that both line numbers should be shown, like the native version

@cheap-glitch

cheap-glitch commented May 26, 2021 •

Copy link
Copy Markdown
Contributor Author

Keep in mind that both line numbers should be shown, like the native version

Do they have to be adjoined though? When the left side is hidden it happens naturally, but when the right side is hidden they will be on both sides of the code:
image

The only fixes I can think of is to use display: flex and order (tried it for bit, it creates a whole slew of new problems) or reorder the <td> elements with JS 🤔

@fregante

fregante commented May 26, 2021 •

Copy link
Copy Markdown
Member

Ahh you're right. Yeah sorting can't be done in a clean/safe way, so we'll have to keep the lines on the right side in that case. Let's see if they make sense or if people complain. The old line number is still relevant information so we should preserve it.

@fregante

Copy link
Copy Markdown
Member

I didn't make an "official" demo screenshot yet

Yeah that should come at last

@cheap-glitch
cheap-glitch marked this pull request as ready for review June 1, 2021 07:38
@yakov116

yakov116 commented Jun 6, 2021

Copy link
Copy Markdown
Member

@cheap-glitch whats the status of this just waiting for approval?

@yakov116 yakov116 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good! Wow!

Comment thread readme.md Resolved
@cheap-glitch cheap-glitch changed the title Add hide-empty-split-diff-side feature Add no-useless-split-diff-view feature Jun 10, 2021
@fregante fregante changed the title Add no-useless-split-diff-view feature Add hide-empty-split-diff-side feature Jun 11, 2021
@fregante
fregante merged commit 30850bc into refined-github:main Jun 11, 2021
@cheap-glitch
cheap-glitch deleted the add-hide-empty-split-diff-side branch June 11, 2021 11:20
@DanFinchUK

Copy link
Copy Markdown

For me this is hiding diffs which are actually useful. As an example, here's how a recent diff looks with this feature enabled:

chrome_2021-06-17T090052

What do you think changed in this commit? Well it looks like that line was added - but it wasn't. The normal split diff looks like this:

chrome_2021-06-17T090115

You can see there's a subtle difference between the commits which is actually very important (there was a bug!)

@cheap-glitch

Copy link
Copy Markdown
Contributor Author

@danielsamuels can you provide an URL where this happens? Thanks

@fregante

Copy link
Copy Markdown
Member

Strange, can't replicate.

Diff that's correctly unified: f60cb71

Reportedly problematic diff: 26e778f

@DanFinchUK

Copy link
Copy Markdown

This is on a GitHub Enterprise instance running 2.22.10, perhaps it's an incompatibility with that version?

@fregante

fregante commented Jun 17, 2021 •

Copy link
Copy Markdown
Member

I think I know what's happening. It checks the left column first, it doesn't find the expected element ([data-split-side="${side}"]:is(.blob-code-addition, .blob-code-deletion)) and therefore it assumes it's empty.

I'll open an issue and disable this feature via hotfix for now

@fregante fregante changed the title Add hide-empty-split-diff-side feature Add no-useless-split-diff-view feature Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Always use single-column diffs if there are no deletions *or* no additions

4 participants