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

Trim trailing whitespace option #11473

Merged
merged 1 commit into from Oct 28, 2021
Merged

Trim trailing whitespace option #11473

merged 1 commit into from Oct 28, 2021

Conversation

Copy link
Contributor

@lovef lovef commented Oct 10, 2021

Summary of the Pull Request

Opt in setting to trim trailing white space when pasting a text into the terminal

References

PR Checklist

  • Closes #9400
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Documentation updated. If checked, please file a pull request on our docs repo and link it here: #xxx
  • Schema updated.
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Manually testing to paste text with and without trailing white spaces, with and without the option activated

@msftbot msftbot bot added Area-User Interface Issue-Task Product-Terminal labels Oct 10, 2021
@lovef lovef force-pushed the trim-paste branch 2 times, most recently from 18bea3b to 6454f73 Compare Oct 12, 2021
@lhecker lhecker added the Needs-Second label Oct 20, 2021
@zadjii-msft
Copy link
Member

@zadjii-msft zadjii-msft commented Oct 26, 2021

@msftbot don't merge this before friday at 7pm

@msftbot
Copy link
Contributor

@msftbot msftbot bot commented Oct 26, 2021

Hello @zadjii-msft!

I think you told me that you want to delay the approval for a certain amount of time, but I am not confident that I have understood you correctly.

Please try rephrasing your instruction to me.

@zadjii-msft
Copy link
Member

@zadjii-msft zadjii-msft commented Oct 26, 2021

@msftbot merge this friday at 7pm

@msftbot
Copy link
Contributor

@msftbot msftbot bot commented Oct 26, 2021

Hello @zadjii-msft!

I think you told me that you would like to reset custom auto-merge settings, but I am not confident that I have understood you correctly.

Please try rephrasing your instruction to me.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Thanks for whipping this up!

@@ -77,6 +77,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
INHERITABLE_SETTING(Model::GlobalAppSettings, winrt::Microsoft::Terminal::Control::CopyFormat, CopyFormatting, 0);
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, WarnAboutLargePaste, true);
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, WarnAboutMultiLinePaste, true);
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, TrimPaste, false);
Copy link
Member

@zadjii-msft zadjii-msft Oct 26, 2021

Choose a reason for hiding this comment

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

Suggested change
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, TrimPaste, false);
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, TrimPaste, true);

Warm take: enable this by default. It's a sensible QoL improvement. I'm gonna give the team till Friday to NAK me on this one.

@lovef If it's not too much trouble, could you add this to defaults.json as well? (mostly just as reference):

"trimPaste": true,

(if you don't, the bot will still just merge this and I can take care of it in post ☺️)

Copy link
Contributor Author

@lovef lovef Oct 26, 2021

Choose a reason for hiding this comment

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

No problm, I added "trimPaste": true,. For it to make sense I also changed the default value in code as per your suggested change

if (pos == textView.npos)
{
// Text is all white space, set empty string
text = L"";
Copy link
Member

@DHowett DHowett Oct 26, 2021

Choose a reason for hiding this comment

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

we can probably just bail all the way out of pasting, right? Or do we need to complete the event handler request?

Copy link
Contributor Author

@lovef lovef Oct 26, 2021

Choose a reason for hiding this comment

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

With a co_return?

Copy link
Contributor Author

@lovef lovef Oct 26, 2021

Choose a reason for hiding this comment

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

Added co_return, seems to work as expected

@zadjii-msft zadjii-msft added the AutoMerge label Oct 28, 2021
@msftbot
Copy link
Contributor

@msftbot msftbot bot commented Oct 28, 2021

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@msftbot msftbot bot merged commit 756fd44 into microsoft:main Oct 28, 2021
8 checks passed
@msftbot
Copy link
Contributor

@msftbot msftbot bot commented Feb 3, 2022

🎉Windows Terminal Preview v1.13.10336.0 has been released which incorporates this pull request.🎉

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface AutoMerge Issue-Task Needs-Second Product-Terminal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants