question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Diffs of very small images are hard to read (2-up) or unusable (onion skin)

See original GitHub issue

Describe the bug

Diffs of images with very small widths are unreadable for 2-up mode: They cause the “Deleted” and “Added” text to overlap and the file stats to merge together.

image

The same diffs are entirely unusable in “onion skin” mode: They cause the slider to be way too small to use (it allows you to drag it to the right and then the slider can no longer be moved at all.)

image

Version & OS

Version 2.6.2, Windows … Version 3.0.5, Windows

Steps to reproduce the behavior

Add an image with a small width to a repository and look at the diff. To save you some time, here’s a couple 16x16 slime sprites:

slime example slime example orange

Expected behavior

There should be a minimum width on the sides of the diff that prevents any of this overlapping. Here’s an example of CSS that could potentially be added to fix this:

/* Fix 2-up image diffs having no minimum size and as a result being incomprehensible */
.panel.image .image-diff-two-up :is(.image-diff-previous, .image-diff-current) {
    min-width: 200px;
}

/* Fix swipe/onion skin image diff slider min-width */
:is(.image-diff-swipe, .image-diff-onion-skin) .slider {
    min-width: 200px;
}

Which produces: image

I would assume you would want to do it via variable and stuff, though, so a hardcoded rule like this probably wouldn’t work. Just showing that it can be solved without too many CSS changes 😃

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ChiriVulpescommented, Jan 28, 2021
  1. Create repository.
  2. Add one of those small images to the repository.
  3. Commit.
  4. Replace the small image with the other one.
  5. Look at the diff.
0reactions
ChiriVulpescommented, Aug 14, 2022

I’ve updated this issue with further information and updated suggestions.

  • It’s not just 2-up that’s got issues at diffs this small, Onion Skin is also broken (it actually doesn’t even work)
  • Updated suggested CSS to also set a minimum slider width in swipe/onion skin modes

I’ll also note that when comparing a diff of a small, transparent, white icon, you legitimately just can’t see anything in the diff at all (that’s also visible in the onion skinning screenshot above). I don’t know if that’s worth fixing, but I fixed it in my local stylesheet by just getting rid of the tiled background since it doesn’t work in my use case (and it’s honestly painful on the eyes in dark mode for larger images anyway) and replacing it with the background colour (which is much less likely to be the same as an image I’m working on than pure white)

/* Remove white background behind images in image diff */
:is(.image-diff-onion-skin, .image-diff-swipe) .sizing-container .image-container, .panel.image :is(.image-diff-previous, .image-diff-current) img {
    background-image: none;
    background: var(--background-color) !important;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Behold: Image view modes - The GitHub Blog
Behold: Image view modes. Now when you view commits that include images you'll be presented with four ways to view them: 2-up, Swipe,...
Read more >
View 2-up / swipe / onion skin controls for merge request diff ...
View the 2-up / swipe / onion skin controls for a merge request diff containing an image. View the controls in the branch...
Read more >
Untitled
Peel the avocado guacamole song, Pomacanthus maculosus wikipedia, ... Xecureexpress, Bill goldberg street fight, Talking animal pictures, Small brothers ...
Read more >
qxI - River Thames Conditions - Environment Agency - GOV.UK
Most difficult surgery ever, Enterprise broken bow streaming, Cross us border ... El pozo de almoguera, Luoi cau ca loc nhat ban, Image...
Read more >
ADOBE® FIREWORKS®
For more information, see Working with CSS sprites in Fireworks CS6. ... Fireworks resamples (resizes) images differently than most image-editing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found