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

FileViewer: Don't show too many lines in MessageBox #10710

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bansan85
Copy link
Contributor

@bansan85 bansan85 commented Feb 10, 2023

Fixes #10709

Proposed changes

  • Truncate message to limit the number of lines of string in a MessageBox.

Test environment(s)

  • Git Extensions 4.0.2.16100
  • Build 25100ec
  • Git 2.39.1.windows.1
  • Microsoft Windows NT 10.0.22621.0
  • .NET 6.0.13
  • DPI 96dpi (no scaling)
  • Microsoft.WindowsDesktop.App Versions
    Microsoft.WindowsDesktop.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Screenshots

Before

image

The MessageBox takes the whole height of my screen.

After without "Output truncated" annotation:

image

After with "Output truncated" annotation:

image

After with TaskDialog

Indent is lost.

image

Merge strategy

I agree that the maintainer squash merge this PR (if the commit message is clear).


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

@ghost ghost assigned bansan85 Feb 10, 2023
@RussKie
Copy link
Member

RussKie commented Feb 10, 2023 via email

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.

LGTM, have not run
I think a truncation indicator is not necessary in this case.
As russkie requested, please provide screenshots in all PRs.

@mstv mstv changed the title Don't show to many lines in MessageBox Don't show too many lines in MessageBox Feb 10, 2023
@mstv mstv changed the title Don't show too many lines in MessageBox FileViewer: Don't show too many lines in MessageBox Feb 10, 2023
@bansan85
Copy link
Contributor Author

bansan85 commented Feb 13, 2023

Move screenshot in PR description

@bansan85
Copy link
Contributor Author

bansan85 commented Feb 13, 2023

Move more screenshot in PR description

@RussKie
Copy link
Member

RussKie commented Feb 13, 2023 via email

@bansan85 bansan85 force-pushed the freeze-reset-selected-lines branch 2 times, most recently from 496bb1a to 5edc68a Compare February 13, 2023 09:51
@bansan85
Copy link
Contributor Author

Use TaskDialog. It's sad that indent is lost. But since I couldn't use a monolith font, indent will always be wrong.

@RussKie
Copy link
Member

RussKie commented Feb 13, 2023 via email

@bansan85
Copy link
Contributor Author

Added in description.

Sorry, I started to update the main description but I forget to click on "Update" button :/

@pmiossec
Copy link
Member

@bansan85 I'm not 100% convinced by the design.
Don't you think we could use the Expander feature of the TaskDialog to hide the patch by default and let the user display it if he wants (because most of the times it's useless)?

image

Like it has been done in #10436...

We could have for the task dialog something like:

  • Heading: "Error when applying the patch"
  • content: content of output variable
  • Expander: content of truncated_diff variable

What do you think?

@bansan85
Copy link
Contributor Author

Totally agree !! I didn't knew about TaskDialog before yesterday. I will try to improve it.

@bansan85 bansan85 marked this pull request as draft February 13, 2023 20:31
@RussKie
Copy link
Member

RussKie commented Feb 14, 2023

Kudos @pmiossec for providing the links. I didn't have those handy.

@RussKie
Copy link
Member

RussKie commented Mar 29, 2023

@bansan85 a friendly nudge. Is this still something you're working on?

@RussKie RussKie added the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Mar 29, 2023
@bansan85 bansan85 force-pushed the freeze-reset-selected-lines branch from 5edc68a to 016f8c1 Compare March 29, 2023 08:25
@ghost ghost removed the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Mar 29, 2023
@bansan85
Copy link
Contributor Author

@RussKie Sorry. I should have kept you in touch.

Not really...

TaskDialog looks cool but after a few hours, I didn't succeed to used it with a good result.

The MessageBox is too width when not expanded.

image

The MessageBox is too height (didn't found how to insert a scroll) when expanded + it looks that the font can't be customized.

image

To reproduce it : insert lots of lines with a unicode char and select in the diff window "US-ASCII".

@bansan85 bansan85 force-pushed the freeze-reset-selected-lines branch from 016f8c1 to 5b8d2dc Compare March 29, 2023 08:32
@bansan85 bansan85 force-pushed the freeze-reset-selected-lines branch from 5b8d2dc to ce3b19e Compare March 29, 2023 08:33
@pmiossec
Copy link
Member

The MessageBox is too height (didn't found how to insert a scroll) when expanded + it looks that the font can't be customized.

For me, the idea was to keep the "Output truncated" annotation feature you did when displaying the patch in the task dialog expander. Because, otherwise, you will indeed always have case where the text is too big to be displayed.

For me the content of the patch is not so important. The most important information is that the reset failed. I can't recall one time where I had a look at the patch in this case. So the most important information is the error message you displayed in the main part of the taskdialog 👍

The MessageBox is too width when not expanded.

Strange. Is it due to the content displayed in the expand section?

@RussKie
Copy link
Member

RussKie commented Mar 30, 2023

I may be able to look into this. Do you have steps to reproduce?

@RussKie RussKie added the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Mar 30, 2023
@bansan85
Copy link
Contributor Author

bansan85 commented Mar 30, 2023

@RussKie

Thanks if you know how to improve it. The only thing I could do to improve the window is to truncate the number of lines in the expandable part of the form.

To reproduce it : insert lots of lines with a unicode char and select in the diff window "US-ASCII".

Select all lines in diff window, right click and try to revert.

image

image

@ghost ghost removed the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Freeze if "Reset selected lines" fails in a huge hunk
4 participants