-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Conversation
18bea3b
to
6454f73
Compare
@msftbot don't merge this before friday at 7pm |
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. |
@msftbot merge this friday at 7pm |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I have to change this setting through the json file, as the doc suggests? I don't see a possibility do set it through the settings dialog.
I'm experiencing the behaviuor for a few days and I am surprised to see the changed behavour was introduced in October 21, already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (pos == textView.npos) | ||
{ | ||
// Text is all white space, set empty string | ||
text = L""; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a co_return
?
There was a problem hiding this comment.
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
Hello @zadjii-msft! Because this pull request has the 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 (
|
🎉 Handy links: |
Question, what about leading whitespace? Just this bit of powershell code as example: function Send-Bytes {
param(
[string] $To,
[string] $Arguments
)
begin {
$startInfo = [System.Diagnostics.ProcessStartInfo]::new()
$startInfo.RedirectStandardInput = $true
$startInfo.FileName = $To
$startInfo.Arguments = $Arguments
$process = [System.Diagnostics.Process]::Start($startInfo)
$inputStream = $process.StandardInput.BaseStream
}
process {
$inputStream.WriteByte([byte]$_)
}
end {
$inputStream.Flush()
$inputStream.Close()
$process.WaitForExit()
}
} It's indented with tabs, if I use Pasting the same thing in Terminal trims all indentation.
|
Summary of the Pull Request
Opt in setting to trim trailing white space when pasting a text into the terminal
References
PR Checklist
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