Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display text if an image cannot be displayed #7868

Merged
1 commit merged into from
Mar 23, 2020

Conversation

gerhardol
Copy link
Member

See #7831 (comment)

Proposed changes

Display a text rather just an empty pane if the image has been removed or cannot be displayed for other reasons.

Screenshots

Before

image

After

image

Test methodology

Manual


✒️ I contribute this code under The Developer Certificate of Origin.

@ghost ghost assigned gerhardol Mar 15, 2020
@vbjay
Copy link
Contributor

vbjay commented Mar 16, 2020 via email

@gerhardol
Copy link
Member Author

Why can't we get the file from git and display that?

This specific change is "low level", it could be that the file could not be displayed as an image (like a text file renamed to .png).

If there is a change, the logic to have special handling for removed images could be changed.
If so, I would like to do this in a follow up:

  • I would like to get RevisionDiff: Stage/Unstage selected lines #7825 and a followup that unifies the presentation of "changes" first
  • How should removed images be displayed, so the user understands that an image is removed?
    For this reason, removed text files are displayed as a diff.
  • Generally, we spend too much time on discussing these edge situations, instead of just adding something that is good enough - what is that here?

@vbjay
Copy link
Contributor

vbjay commented Mar 16, 2020 via email

@gerhardol
Copy link
Member Author

Why touch it twice.

It is another part of the logic, and I have several PRs to clean up that first before making such a change.

Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

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

👍

if (image == null)
{
ResetForText(null);
internalFileViewer.SetText($"Cannot view image {fileName}", openWithDifftool);
Copy link
Member

Choose a reason for hiding this comment

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

Localise please

Copy link
Member Author

Choose a reason for hiding this comment

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

Done
Generally I believe translation is overkill for something like this, but I allow it as it is (at least currently) shown for removed images.
Unless there are further comments in the next two days, I will squash and schedule a merge

@ghost ghost added the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Mar 19, 2020
@ghost ghost removed the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Mar 20, 2020
Copy link
Member

@RussKie RussKie left a comment

Choose a reason for hiding this comment

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

A little change needed. Otherwise good

GitUI/Editor/FileViewer.cs Outdated Show resolved Hide resolved
@gerhardol
Copy link
Member Author

I updated the translation on top of #7877, still fails in master

GitUI/Translation/English.xlf Outdated Show resolved Hide resolved
@RussKie
Copy link
Member

RussKie commented Mar 21, 2020 via email

@mstv
Copy link
Member

mstv commented Mar 21, 2020

I think it will fail if merged before...

So fix up the final nit and merge #7877, please, @RussKie. 😀

@RussKie
Copy link
Member

RussKie commented Mar 21, 2020 via email

GitUI/Editor/FileViewer.cs Outdated Show resolved Hide resolved
@gerhardol
Copy link
Member Author

@msftbot merge in 24 hours

@ghost ghost added the status: auto merge label Mar 22, 2020
@ghost
Copy link

ghost commented Mar 22, 2020

Hello @gerhardol!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I won't merge this pull request until after the UTC date Mon, 23 Mar 2020 11:32:12 GMT, which is in 1 day

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@RussKie
Copy link
Member

RussKie commented Mar 22, 2020 via email

@ghost ghost merged commit 39bb7a2 into gitextensions:master Mar 23, 2020
@ghost ghost added this to the 4.0 milestone Mar 23, 2020
@gerhardol gerhardol deleted the bugfix/removed-image branch November 14, 2021 13:01
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants