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

Refactor usage of clipboard #2022

Merged

Conversation

springcomp
Copy link
Contributor

@springcomp springcomp commented Dec 6, 2020

PR Summary

While working on various upcoming PRs (notably #1674 and #584) I noticed this would be easier if some code cleanup/refactoring had taken place before,

I noticed a common pattern while trying to remove some text while supporting undo:

_singleton.SaveToClipboard(start, count, instigator, arg);
_singleton.SaveEditItem(start, count, EditItemCreate(_clipboard, start, instigator, arg));
_singleton.Remove(position, length);

Therefore, this PR introduces a new method to promote this pattern and refactors all ocurrences to use the new method.
While doing so, I also slightly refactor one or two obvious related changes to the clipboard handling.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure you've added one or more new tests
  • Make sure you've tested these changes in terminals that PowerShell is commonly used in (i.e. conhost.exe, Windows Terminal, Visual Studio Code Integrated Terminal, etc.)
  • User-facing changes
    • Not Applicable
Microsoft Reviewers: Open in CodeFlow

Copy link
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

Thanks for the refactoring, look mostly good to me, with a few comments.

@ghost ghost added the Needs-Author Feedback label Jan 7, 2021
@ghost ghost removed the Needs-Author Feedback label Jan 19, 2021
@springcomp
Copy link
Contributor Author

@daxian-dbw I believe I have addressed all feedback.
Please, would you re-review?

Copy link
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

LGTM. I will help resolve the conflict.

@daxian-dbw daxian-dbw merged commit 9d5b41f into PowerShell:master Feb 10, 2021
@ghost
Copy link

ghost commented Feb 23, 2021

🎉 v2.2.0-beta2 has been released which incorporates this pull request. 🎉

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.

2 participants