terminal
terminal copied to clipboard
AtlasEngine: Improve dotted, dashed and curly underlines
This changeset makes 3 improvements:
- Dotted lines now use a 2:1 ratio between gaps and dots (from 1:1). This makes the dots a lot easier to spot at small font sizes.
- Dashed lines use a 1:2 ratio and a cells-size independent stride. By being cell-size independent it works more consistently with a wider variety of fonts with weird cell aspect ratios.
- Curly lines are now cell-size independent as well and have a height that equals the double-underline size. This ensures that the curve isn't cut off anymore and just like with dashed lines, that it works under weird aspect ratios.
Closes #16712
Validation Steps Performed
This was tested using RenderingTests using Cascadia Mono, Consolas, Courier New, Lucida Console and MS Gothic.
Cascadia Code, 12pt, 150% display scale (an edge case because it has just barely a 1px underline width):
Zoomed 4x:
I've force-merged this PR because the ARM64 build was stuck with "Artifact ... already exists for build ...".
Am I correct in the assumption that different styles for underlining are still not considered, well, a standard? Simply something that some terminal emulators added on their own?
So, what's the proper way to use them in WT? Like, with PowerShell?
A significant portion of "standards" are actually just "things that most terminals agree on" and not actually standardized. If you want to go for maximum compatibility, you should only use straight ("`e[4m") and double underlines ("`e[21m"). If I was writing a terminal application today, I'd just rely on underline styles and make it an option for users to not use them if they want to.
True, it's more a "standard" and not a standard, should've made that more clear.
I think I found it:
| Underline Style | ANSI SGR Sequence (Powershell) |
|---|---|
| no underline | `e[4:0m |
| straight underline | `e[4:1m |
| double underline | `e[4:2m |
| curly underline | `e[4:3m |
| dotted underline | `e[4:4m |
| dashed underline | `e[4:5m |
| straight underline (for backwards compat) | `e[4m |
| no underline (for backwards compat) | `e[24m |
Colors for underline styles seem to work as well, nice!
"string with `e[4:4mdotted underline`e[24m, and `e[4:4m`e[58:5:166mdotted underline in color`e[0m, yay!"
The trick is that you need : as a separator for the values in the ANSI sequence, I wasn't sure if PowerShell could properly handle that..
But it seems that is the case..