PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

[PTRun][UnitConverter]Add support for `sq` prefix for square units

Open PesBandi opened this issue 1 year ago • 1 comments

Summary of the Pull Request

Adds support for using sq instead of ^2, for example sqcm instead of cm^2.

PR Checklist

  • [x] Closes: #37553, #37648
  • [ ] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • [x] Tests: Added/updated and all pass
  • [x] Localization: All end user facing strings can be localized
  • [x] Dev docs: No need
  • [x] New binaries: None
  • [ ] Documentation updated: Not yet

Detailed Description of the Pull Request / Additional comments

  • Replaces sq with ² if before a unit that can be square.
  • Works for the following units: s, μm, mm, cm, dm, m, km, mil, in, ft, yd, mi, nmi, ft (US)
  • Unlike the original PR, this also works with more complex units, such as m/sqs instead of m/s^2.

Validation Steps Performed

Added tests, manually tested a bunch of units

PesBandi avatar Mar 10 '25 13:03 PesBandi

@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)

nmi

These words are not needed and should be removed ahk AMPROPERTY AMPROPSETID Breadcrumb CDEF comdef ddf devenum DEVMON DEVSOURCE DGR DIIRFLAG dshow DVH DVHD DVSD DVSL EData ERole fdw FILEINFOSIG Filtergraph Filterx HCERTSTORE IKs iljxck IYUV KSPROPERTY lcb ldx lld LONGLONG LTRB majortype makecab MEDIASUBTYPE mediatype mfplat mic mjpg Msimg msiquery ORAW outpin overlaywindow PAUDIO PINDIR Pnp ppmt previouscamera PROPBAG propvarutil reencoded REFGUID REGFILTER REGFILTERPINS REGPINTYPES regsvr shmem sizeread stl strsafe strutil subquery SYNCMFT TMPVAR vcdl vdi vid VIDCAP VIDEOINFOHEADER vih webcam wistd WVC

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]:PesBandi/PowerToys.git repository on the launcher-unitconvert-square branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.24/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/13766250399/attempts/1'

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.txt file 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.txt file.

    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.

github-actions[bot] avatar Mar 10 '25 13:03 github-actions[bot]

LGTM.

But, could you please add at least one picture in the description to show the usage of your new units format?

moooyo avatar Mar 14 '25 09:03 moooyo

/azp run

moooyo avatar Mar 14 '25 09:03 moooyo

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Mar 14 '25 09:03 azure-pipelines[bot]

Hi @moooyo, thanks for the review. I've added some screenshots to the description, you can check them out.

PesBandi avatar Mar 14 '25 15:03 PesBandi

Do you think I should mention this in the docs?

PesBandi avatar Mar 14 '25 15:03 PesBandi

Do you think I should mention this in the docs?

I believe so. It's better.

moooyo avatar Mar 17 '25 03:03 moooyo