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

T1.5-Modify the VisualDifferenceViewer so text wraps instead of using scrollviewers #10932

Merged

Conversation

SHKnudsen
Copy link
Contributor

@SHKnudsen SHKnudsen commented Jul 23, 2020

Based on PR #10928 , please merge that first

Purpose

This PR addresses the wish to have the text in the Code Difference viewer wrap instead of using scrollviewers, to make it more in style with the Python script editor. I have looked into modifying the DiffPlex viewer but couldn't find a way to do this. This PR creates new views that behaves and looks like the original DiffPlex viewer but adds wrapping to the text.

The caveat of this approach is that it adds a lot more code than using the DiffPlex viewer. We still need the Dependence on DiffPlex but we can remove the reference to DiffPlex.Wpf

T1 5-DiffViewerWithTextWrap

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.

Reviewers

@mmisol

FYIs

@mjkkirschner
@QilongTang
@Amoursol
@radumg

* add ScriptMigrator

* Add visual difference viewer

* Update PythonMigrationViewExtension.cs

* Add tooltip description to migration assistant

* updates

* comment updates

* comment updates
* add ScriptMigrator

* Add visual difference viewer

* Added methods for updating the ScriptEditors with the migrated code

* Update PythonMigrationViewExtension.cs

* Add tooltip description to migration assistant

* updates

* comment updates

* comment updates

* Update ScriptEditorWindow.xaml.cs

* Update PythonMigrationViewExtension.csproj

* Update PythonMigrationViewExtension.csproj

* comment updates

* Revert "comment updates"

This reverts commit 2d2332a.

* comment updates

* Update PythonMigrationAssistantViewModel.cs

* comment updates 2
* add ScriptMigrator

* Add visual difference viewer

* Added methods for updating the ScriptEditors with the migrated code

* Update PythonMigrationViewExtension.cs

* add mechanisme to save Python 2 backup

* Add tooltip description to migration assistant

* updates

* comment updates

* comment updates

* Update ScriptEditorWindow.xaml.cs

* Update PythonMigrationViewExtension.csproj

* Update PythonMigrationViewExtension.csproj

* comment updates

* Revert "comment updates"

This reverts commit 2d2332a.

* comment updates

* Update PythonMigrationAssistantViewModel.cs

* comment updates 2

* small clean ups

* Update PythonMigrationAssistantViewModel.cs
@radumg radumg added the DNM Do not merge. For PRs. label Jul 29, 2020
@radumg
Copy link
Collaborator

radumg commented Jul 29, 2020

To solve conflicts ahead of time and incorporate fixes, i've rebased this on the branch for #10928 , so please merge that first and then this one.

@radumg
Copy link
Collaborator

radumg commented Jul 29, 2020

The width of the code (text) area can't be matched when window size is exactly the same as we're always going to have the additional space for the + or - indicators, so went ahead with subtly making the differ windows larger.

Also used the lorem ipsum text as a more accurate indicator on how the word wrap affects multi-line paragraphs.

Inline

image

Side by side

image

also allow for slightly larger vertical height for Before/After label as it was hard to spot
@radumg
Copy link
Collaborator

radumg commented Jul 29, 2020

Colours updated

  • update red/green to suit supplied colours
  • updated vertical splitter in side comparison layout to be black instead of white to better match the Dynamo viewports

image

@radumg
Copy link
Collaborator

radumg commented Jul 30, 2020

Also upgraded the inline view to now show the exact fragments of what's changed, instead of a simple deleted/changed for the entire line.

Before

Entire block of text is highlighted the same way.
image

After

Block of text has background with change type
Actual changed bits, the ( and ) are highlighted

improved inline view

@radumg radumg added Python UI and removed DNM Do not merge. For PRs. labels Jul 30, 2020
@radumg radumg removed their request for review July 30, 2020 00:14
@radumg
Copy link
Collaborator

radumg commented Jul 30, 2020

That should wrap this one up as well, please have a look @mmisol , @mjkkirschner

@Amoursol
Copy link
Contributor

Looking pretty epic to me @radumg! Thank you.

@mmisol
Copy link
Collaborator

mmisol commented Jul 31, 2020

@Amoursol Bringing this to your attention because it got hidden in a conversation #10932 (review)

To summarize, I can see a slight difference in wrapping that @radumg was not able to reproduce on his end. It could be related to a combination of DPI settings and screen resolution but we are not sure. How do you think we should deal with this?

@Amoursol
Copy link
Contributor

@mmisol Unless we can reproduce the issue, in which case we should definitely resolve, I am fine with minor visual differences. Do we have a 3rd machine we can test on? One of our Virtual test machines? It may be a Mac vs. Windows issue.

@SHKnudsen
Copy link
Contributor Author

@mmisol @radumg tested this on my machine as well and everything seems to wrap as expected. I made a few small changes to make sure the sizing of the diff viewer is consistent.

@mmisol
Copy link
Collaborator

mmisol commented Aug 3, 2020

Thanks for testing @SHKnudsen . Still wraps different for me but this should be good to go. I'll delay approval until we merge the other PR, just in case to prevent any issues.

@@ -19,6 +19,8 @@ internal BaseDiffViewer(PythonMigrationAssistantViewModel viewModel)
{
ViewModel = viewModel;
DataContext = viewModel;
// The diff viewer is initialized with the SideBySide view
SetSideBySideWindowWidth();
Copy link
Collaborator

Choose a reason for hiding this comment

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

@SHKnudsen , let's put this after the initialize component method call

@mmisol
Copy link
Collaborator

mmisol commented Aug 4, 2020

@SHKnudsen @radumg #10928 got merged. Could you rebase this PR so that we can approve it and merge it too?

@SHKnudsen
Copy link
Contributor Author

@mmisol should be ready now.

Copy link
Collaborator

@mmisol mmisol left a comment

Choose a reason for hiding this comment

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

@mmisol mmisol merged commit 6fe9df4 into DynamoDS:master Aug 5, 2020
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.

5 participants