Skip to content

Conversation

@skyline75489
Copy link
Collaborator

@skyline75489 skyline75489 commented Oct 19, 2020

This PR improves the OSC 8 Hyperlink parsing logic, by adding support to
: in params.

Validation Steps Performed

Tests added & passed.

@skyline75489
Copy link
Collaborator Author

Pro tips: you may want to use "Split" mode to view the diff.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

protip: also use the "Hide whitespace changes" option, makes this even easier to review.

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 19, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 20, 2020
@skyline75489 skyline75489 changed the title Use SplitString to simplify OSC parsing logic Improve OSC 8 Hyperlink parsing logic Oct 20, 2020
@skyline75489
Copy link
Collaborator Author

skyline75489 commented Oct 20, 2020

After some consideration, I've repurposed this PR to improve the OSC 8 hyperlink parsing, instead of just trying to make use of SplitString. I've added the support for : inside the OSC 8 params and added some test cases.

The usage of : is described here https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#the-escape-sequence

Copy link
Contributor

@PankajBhojwani PankajBhojwani left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you for this!

@microsoft-github-updates microsoft-github-updates bot changed the base branch from master to main October 22, 2020 00:26
result = SplitString(L"1", L';');
VERIFY_ARE_EQUAL(1u, result.size());
result = SplitString(L";", L';');
VERIFY_ARE_EQUAL(2u, result.size());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK the result may seem weird in a general purpose function. But it works pretty well as for parameter parsing for VT sequences.

@skyline75489
Copy link
Collaborator Author

A ping to stop the bot from marking the PR as stale.

@zadjii-msft zadjii-msft added Area-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. Area-VT Virtual Terminal sequence support labels Nov 5, 2020
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

Minor things

Co-authored-by: Dustin L. Howett <dustin@howett.net>
@skyline75489
Copy link
Collaborator Author

Well, what do you know, the "minor" thing is causing error C26445: A reference to gsl::span or std::string_view may be an indication of a lifetime issue (gsl.view)....

@DHowett
Copy link
Member

DHowett commented Nov 13, 2020

Hmm. That warning seems to be overzealous. We should suppress it.

@github-actions
Copy link

New misspellings found, please review:

  • quux
To accept these changes, run the following commands
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect/alphabet.txt
.github/actions/spell-check/expect/expect.txt
.github/actions/spell-check/expect/web.txt"');
@ARGV=@expect_files;
my @stale=qw('"akb appdata Autogenerated autologin CParams cppcorecheck debian debugbreak decf DECLL DECSMBV esa FILEPATH guidgenerator hhhh Inplace keith keybound naws notypeopt openlogo restrictederrorinfo rgus richturn Scs SGRXY subnegotiation Switchto telnetpp winver Wlk wslhome xe "');
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)(?:$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect/e79b117934a38399c30aedab4feb84fe15aa3bf5.txt";
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"autogenerated CPPCORECHECK Debian filepath inplace quux WINVER "');
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;'
git add .github/actions/spell-check/expect || echo '... you want to ensure .github/actions/spell-check/expect/e79b117934a38399c30aedab4feb84fe15aa3bf5.txt is added to your repository...'
✏️ 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/spell-check/dictionary/names.txt.
  • ... APIs, you can add them to a file in .github/actions/spell-check/dictionary/.
  • ... just things you're using, please add them to an appropriate file in .github/actions/spell-check/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/spell-check/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. 😉

⚠️ Reviewers

At present, the action that triggered this message will not show its ❌ in this PR unless the branch is within this repository.
Thus, you should make sure that this comment has been addressed before encouraging the merge bot to merge this PR.

@skyline75489
Copy link
Collaborator Author

Hey, what do you know, the tests passed like it should. @DHowett Can I get a green light on this one?

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

Thanks! Sorry -- I was worried about making some string parsing changes as it were. I kicked back for far too long on this PR.

@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Dec 3, 2020
@ghost
Copy link

ghost commented Dec 3, 2020

Hello @DHowett!

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.

@ghost ghost merged commit 3181b6a into microsoft:main Dec 3, 2020
@skyline75489 skyline75489 deleted the chesterliu/dev/more-split-string branch December 3, 2020 00:35
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-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. Area-VT Virtual Terminal sequence support AutoMerge Marked for automatic merge by the bot when requirements are met

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants