-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Curly, dotted and dashed underlines #149
Comments
@spacekitteh, thanks for looking into this. I think the starting point is to understand the extent to which these features have actually been adopted by (or are on the blocks for) the most popular terminals on Windows (including the native Windows Terminal), macOS (including the native Terminal app) and on Linux distributions. As the Where a niche feature is implemented, the package strives for high quality Haddock documentation to give users a heads up on the limitation of using the feature cross-plaform. |
I know that VTE, minTTY, and iTerm2 support them as well, and I'm pretty sure I'm forgetting a couple of others. I think Windows Terminal supports them too? Apparently xterm.js and ST do too. However, this still leaves open the question about the CSICode type: The spec says that subparameters can be separated by colons, so the current situation where CSI codes are always separated by semicolons doesn't allow for that. So for spec correctness, I think that that is still something that should be done anyway. |
This - microsoft/terminal#7228 - seems to be a request to add the functionality to Windows Terminal; the issue provides a review of supporting terminals. |
Yeah out of those it looks like only Windows Terminal doesn't support it yet. |
In respect of CSI, |
microsoft/terminal#7223 is double underlying only. Double underlying is already supported by this package, as it is SGR 21. See 8.3.117 of ECMA-48. |
I think something like this: data CSICode = Simple Int | Complex String |
As 'fancy' underlining does seems to be supported by a number of terminals, and seems to be in active consideration for Windows Terminal too, then implementing it here is fine. There is a tension over whether the API of this package should reflect (when there is a conflict): (a) the structure of 'ANSI' codes; or (b) the structure of what end users want to achieve. This 'fancy' underlying functionality is clearly outside of SGR in terms of codes, but it does something 'like' what parts of SGR do. Personally, I fall in the former camp and I am attracted to your option No. 2 in your initial post - perhaps the type is |
Is it actually outside of SGR though? Is SGR specifically defined to accept no non-integer parameters? |
Something like this would be more accurate: data CSIParameter = SimpleParameter Int
| ComplexParameter [Int] [Int] -- Before and after colon separator
data CSICodes = CSICodes [CSIParameter] Char -- Parameters + Control function |
Of course, you could just define an enum with 0-9 to restrict the types even further. |
I see what you mean. I was thinking that SGR was limited to the Ps listed at ECMA-48 8.3.117, but this could be viewed as an extension to SGR (SGR '4 and a bit'). |
In which case, I think a breaking change to extend the constructors of |
Yeah, also see the note: That could be interpreted as "what parameter values mean" as well as "what parameters are accepted", in addition to "which parameters work with which others" |
You could also rename the existing constructors, and introduce some parameter synonyms, and mark them as complete, defaulting curly/dotted/dashed to just mean single underline, too. |
One can get carried away with types. Another way to go might be new functions |
That might be the simplest way forward. |
One other thing is underline colours; the simplest way forward is to add "UnderlineColor" to the ConsoleLayer type; this fits in nicely due to it being code 58 and working the same as 38/48. |
Under 13.1.8 of T.416 (03/93), certain SGR parameter values can be followed by a parameter substring (also known as subparameters). T.416 used them for SGR parameter values 38 and 48, but they have also been put to use in the case of fancy and coloured underlining.
Under 13.1.8 of T.416 (03/93), certain SGR parameter values can be followed by a parameter substring (also known as subparameters). T.416 used them for SGR parameter values 38 and 48, but they have also been put to use in the case of fancy and coloured underlining.
@spacekitteh, I've returned to this because the implementation of the feature request for Windows Terminal has recently been merged and so this looks to be available cross-platform soon. I've raised two pull requests (#161 - subparameters, and #162 - changes to API) which are draft while I test that they do what I intend them to do. You will see that I picked I also settled on The package emphasises backwards compatibility and stability, so I provided |
Under 13.1.8 of T.416 (03/93), certain SGR parameter values can be followed by a parameter substring (also known as subparameters). T.416 used them for SGR parameter values 38 and 48, but they have also been put to use in the case of fancy and coloured underlining.
Under 13.1.8 of T.416 (03/93), certain SGR parameter values can be followed by a parameter substring (also known as subparameters). T.416 used them for SGR parameter values 38 and 48, but they have also been put to use in the case of fancy and coloured underlining.
Under 13.1.8 of T.416 (03/93), certain SGR parameter values can be followed by a parameter substring (also known as subparameters). T.416 used them for SGR parameter values 38 and 48, but they have also been put to use in the case of fancy and coloured underlining.
Under 13.1.8 of T.416 (03/93), certain SGR parameter values can be followed by a parameter substring (also known as subparameters). T.416 used them for SGR parameter values 38 and 48, but they have also been put to use in the case of fancy and coloured underlining.
Under 13.1.8 of T.416 (03/93), certain SGR parameter values can be followed by a parameter substring (also known as subparameters). T.416 used them for SGR parameter values 38 and 48, but they have also been put to use in the case of fancy and coloured underlining.
Under 13.1.8 of T.416 (03/93), certain SGR parameter values can be followed by a parameter substring (also known as subparameters). T.416 used them for SGR parameter values 38 and 48, but they have also been put to use in the case of fancy and coloured underlining.
Under 13.1.8 of T.416 (03/93), certain SGR parameter values can be followed by a parameter substring (also known as subparameters). T.416 used them for SGR parameter values 38 and 48, but they have also been put to use in the case of fancy and coloured underlining.
Now merged. |
So, I'm working on a patch which will add more underline styles; the problem is that the SGR codes for them is as follows:
(https://sw.kovidgoyal.net/kitty/underlines/)
Note that they are separated by colons, not by semicolons; if I were to include these into the
Underlining
type, then insgrToCode
, these would have to be output as, say,[4, 3]
, which, in an CSI sequence, means "underline and italics".There are a number of ways to deal with this:
sgrToCode
, just output "4" for the new styles, and deal with it insetSGRCode
, and add a note in the docs forsgrToCode
about itsetUnderlineStyle
function which will do it, and use a different datatype thanUnderlining
CSICode
(or similar), and change the type ofsgrToCode
to return a list ofCSICode
s. This is probably the most principled approach, but certainly the most invasive.What do you suggest?
The text was updated successfully, but these errors were encountered: