terminal
terminal copied to clipboard
Escape single quotes for WSL
Summary of the Pull Request
This commit escapes single quotes ' (allowed in the Win32 subsystem) with '\'' (finish quote, print a single quote then begin quote again), which is a valid escape in the context of the POSIX shell, when a file/folder is dropped to a WSL tab.
Note: '"'"' on the first submission of this PR.
References and Relevant Issues
- #18006
- #16214
Detailed Description of the Pull Request / Additional comments
This is a follow-up of #16214 and fixes #18006.
Validation Steps Performed
PR Checklist
- [x] Closes #18006
- [ ] Tests added/passed
- [ ] Documentation updated
- If checked, please file a pull request on our docs repo and link it here: #xxx
- [ ] Schema updated (if necessary)
@microsoft-github-policy-service agree
Would it be simpler to paste with double quotes and handle escaping of significant characters like $, ', or " with backspaces?
@lhecker I would prefer searching for just one character ('), not three (three you mentioned minus ' plus backquote) I guess. Plus, single quote approach makes making mistakes or shell-dependent sequences almost impossible.
The inserting sequence '"'"' is odd (I have to admit) but in both quote cases (double and single), we would not escape so frequently.
Also, escaping just like @sh formatting logic in jq seems simpler. Will change:
Old: '"'"'
New: '\''
Additional references:
Hey, sorry about this - I didn't realize we had an open PR in this area when I changed how path translation works. You will probably have conflicts or outright failures once you merge main because isWSL has moved to a farm upstate.
@DHowett I see. I'll check the code again and resubmit the new version later (if #18006 is remaining).
Checked.
Surprisingly, there's no merge conflicts... but fails to compile due to the lost isWSL variable.
The solution seems to be simple and working on it.
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.
Unrecognized words (1)
occured
Previously acknowledged words that are now absent
barbaz Ralph stb 🫥To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:a4lg/terminal.git repository
on the wsl-escape-single-quotes branch (:information_source: how do I use this?):
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.22/apply.pl' |
perl - 'https://github.com/microsoft/terminal/actions/runs/11974465747/attempts/1'
Available :books: dictionaries could cover words (expected and unrecognized) not in the :blue_book: dictionary
This includes both expected items (2229) from .github/actions/spelling/expect/alphabet.txt .github/actions/spelling/expect/expect.txt .github/actions/spelling/expect/web.txt and unrecognized words (1)
| Dictionary | Entries | Covers | Uniquely |
|---|---|---|---|
| cspell:cpp/src/lang-jargon.txt | 11 | 1 | 1 |
| cspell:swift/src/swift.txt | 53 | 1 | 1 |
| cspell:gaming-terms/dict/gaming-terms.txt | 59 | 1 | 1 |
| cspell:monkeyc/src/monkeyc_keywords.txt | 123 | 1 | 1 |
| cspell:cryptocurrencies/cryptocurrencies.txt | 125 | 1 | 1 |
Consider adding them (in .github/workflows/spelling2.yml) for uses: check-spelling/[email protected] in its with:
with:
extra_dictionaries:
cspell:cpp/src/lang-jargon.txt
cspell:swift/src/swift.txt
cspell:gaming-terms/dict/gaming-terms.txt
cspell:monkeyc/src/monkeyc_keywords.txt
cspell:cryptocurrencies/cryptocurrencies.txt
To stop checking additional dictionaries, add (in .github/workflows/spelling2.yml) for uses: check-spelling/[email protected] in its with:
check_extra_dictionaries: ''
Errors (1)
See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.
| :x: Errors | Count |
|---|---|
| :x: ignored-expect-variant | 6 |
See :x: Event descriptions for more information.
:pencil2: 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.
If the listed items are:
- ... misspelled, then please correct them instead of using the command.
- ... names, please add them to
.github/actions/spelling/allow/names.txt. - ... APIs, you can add them to a file in
.github/actions/spelling/allow/. - ... 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.
:microscope: 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. :wink:
If the flagged items are :exploding_head: false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.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). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
Overhauled the PR to adopt my changes over @DHowett's.
@DHowett @lhecker
I'm glad to see that there's a plan to fix #18006 for version 1.21 and 1.22 (on the servicing pipeline)!
For the time your team incorporate (backport) the fix in those versions, I made a branch wsl-escape-single-quotes-for-v1.22.
The code is identical to the PR version 2 (that fits 1.21 and 1.22 better than version 4) but incorporates some clarifications from the final merged version (PR version 4).
Sweet! That saves me a bunch of time as usually I’m doing the backports myself. Thank you :)
f62754397 (1.21) and 787872875 (1.22, also what a weird-looking SHA1 prefix) queued for servicing.