Skip to content

Disable warning about multi-line paste when brackted paste is on#9586

Merged
3 commits merged intomicrosoft:mainfrom
skyline75489:chesterliu/dev/silent-multi-line-paste-warning
Apr 7, 2021
Merged

Disable warning about multi-line paste when brackted paste is on#9586
3 commits merged intomicrosoft:mainfrom
skyline75489:chesterliu/dev/silent-multi-line-paste-warning

Conversation

@skyline75489
Copy link
Collaborator

@skyline75489 skyline75489 commented Mar 23, 2021

Closes #7006

@ghost ghost added Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. labels Mar 23, 2021
@github-actions
Copy link

Misspellings found, please review:

  • bracketd
To accept these changes, run the following commands from this repository on this branch
pushd $(git rev-parse --show-toplevel)
perl -e '
my @expect_files=qw('".github/actions/spelling/expect/alphabet.txt
.github/actions/spelling/expect/expect.txt
.github/actions/spelling/expect/web.txt"');
@ARGV=@expect_files;
my @stale=qw('"aspnet boostorg BSODs Cac COINIT dahall fde fea fmtlib isocpp mintty NVDA pinam QOL remoting unte vcrt what3words xamarin "');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
  if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
  next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect/d972ea2c28c2766f2c27524e38e3f6cac4442511.txt";
use File::Path qw(make_path);
make_path ".github/actions/spelling/expect";
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"bracketd cac coinit Remoting "');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a) cmp lc($b)} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;'
popd
✏️ Contributor please read this

By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.

⚠️ The command is written for posix shells. You can copy the contents of each perl command excluding the outer ' marks and dropping any '"/"' quotation mark pairs into a file and then run perl file.pl from the root of the repository to run the code. Alternatively, you can manually insert the items...

If the listed items are:

  • ... misspelled, then please correct them instead of using the command.
  • ... names, please add them to .github/actions/spelling/dictionary/names.txt.
  • ... APIs, you can add them to a file in .github/actions/spelling/dictionary/.
  • ... just things you're using, please add them to an appropriate file in .github/actions/spelling/expect/.
  • ... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in .github/actions/spelling/patterns/.

See the README.md in each directory for more information.

🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉

🗜️ If you see a bunch of garbage and it relates to a binary-ish string, please add a file path to the .github/actions/spelling/excludes.txt file instead of just accepting the garbage.

File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).


if (warnMultiLine)
{
const auto focusedTab = _GetFocusedTabImpl();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is awkward. I wish I can do this in the background thread. But If I do that, it just crashes. So I have to do it here. And the logic is kinda messed up.

Copy link
Member

Choose a reason for hiding this comment

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

Probably due to the call to

        if (_tabView.TabItems().IndexOf(_tabView.SelectedItem(), focusedIndex))

Presumably that has to happen on the FG thread

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My first attempt is to do the check outside if (warnMultiLine || warnLargeText), which is much more streamlined. But it'll crash. So I have to do this inside if (warnMultiLine || warnLargeText) and double-check it after switching to FG thread.


if (warnMultiLine)
{
const auto focusedTab = _GetFocusedTabImpl();
Copy link
Member

Choose a reason for hiding this comment

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

Probably due to the call to

        if (_tabView.TabItems().IndexOf(_tabView.SelectedItem(), focusedIndex))

Presumably that has to happen on the FG thread

ClipboardContentScrollViewer().ScrollToVerticalOffset(0);

ContentDialogResult warningResult;
ContentDialogResult warningResult = ContentDialogResult::Primary;
Copy link
Member

Choose a reason for hiding this comment

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

Curious, what was the default-constructed value for this ContentDialogResult. Did setting it to Primary change anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The default-constructed value is garbage data, like an uninitialized integer. I had to make it "Primary" to make it not co_return directly. read the logic

Copy link
Member

Choose a reason for hiding this comment

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

Indeed! It was uninitialized!

If you initialize it with {}, it will be whichever one matches 0

@zadjii-msft zadjii-msft added the Needs-Second It's a PR that needs another sign-off label Mar 29, 2021
@DHowett DHowett changed the title Do not warn about multi-line paste when brackted paste is on Disable warning about multi-line paste when brackted paste is on Apr 7, 2021
@DHowett
Copy link
Member

DHowett commented Apr 7, 2021

@msftbot merge this in 10 minutes

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label Apr 7, 2021
@ghost
Copy link

ghost commented Apr 7, 2021

Hello @DHowett!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I won't merge this pull request until after the UTC date Wed, 07 Apr 2021 17:29:10 GMT, which is in 10 minutes

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@ghost ghost merged commit ed1cd32 into microsoft:main Apr 7, 2021
@ghost
Copy link

ghost commented Apr 14, 2021

🎉Windows Terminal Preview v1.8.1032.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Settings Issues related to settings and customizability, for console or terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Second It's a PR that needs another sign-off Priority-3 A description (P3) Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't warn about multiline paste to editor

3 participants