Feature underline

It works with WindowsDriver, CursesDriver and NetDriver(windows).
The only thing that seems off to me is that I did not make Attribute.Value contain this value as well.
If someone is using this value assuming it only have color, it would be very bad.
NetDriver sets the biggest number.
value = ((((int) f) & 0xffff) << 16) | (((int) b) & 0xffff)
with ConsoleColor.White = 15
value == 0xF000F
using something like 0x100000 for underline would be possible if I'm not wrong.
Tell me what you think. I set this as a draft.
Good work. Any day we will have the #48 RGB working :-)
You can play with that limit values, you'll see very interesting. You can achieve a greater colors values. Only it'll need to change the default for each of ColorScheme. Otherwise you'll have identical colors.
It's possible to underline only words too?
Yes you, can underline words, like you change the color of a word.
I just realized that it will only work for windows, when using the netdriver.
I am pleased for my CSI (Code Sequence Introducer) implementation on the NetDriver. Too bad it's too slow on Windows.
I just realized that it will only work for windows, when using the netdriver. (@jmperricone)
Now that I read this, it seems to me that it is not clear.
It works with CursesDriver and the WindowsDriver.
What I meant is that with the NetDriver, it only works on Windows. This is what I did:
void SetUnderline (bool state)
{
redrawUnderline = state;
if (IsWinPlatform == true) {
var OutputHandle = NetWinVTConsole.GetStdHandle (NetWinVTConsole.STD_OUTPUT_HANDLE);
var success = NetWinVTConsole.GetConsoleScreenBufferInfo (OutputHandle, out var csbi);
if (success) {
if (state == true) {
csbi.wAttributes |= 0x8000;
} else {
csbi.wAttributes &= 0x7FFF;
}
NetWinVTConsole.SetConsoleTextAttribute (OutputHandle, csbi.wAttributes);
}
}
}
What I meant is that with the NetDriver, it only works on Windows.
You don't need to use Windows API to work on Windows. The only reason I use Windows API was because the System.Console don't recognize escape sequences on Windows and I needed to use ENABLE_VIRTUAL_TERMINAL_PROCESSING for that. To do that, you need to use escape sequences "\x1B[4m" to underline and "\x1B[24m" to reset, maintaining any colors set, both valid to Windows and Linux.
But is better to add the underline bitwise to the contents attribute than increase the contents length to save the underline.
@jmperricone, when you have the time please check my PR https://github.com/jmperricone/gui.cs/pull/1, please. Thanks.
Hi, thanks for the pull #1 @BDisp
About the bitwise underline, I thought about that:
If someone is using this value assuming it only have color, it would be very bad. https://github.com/migueldeicaza/gui.cs/pull/1275#issuecomment-829734583
Because Driver.GetAttribute() is
public override Attribute GetAttribute ()
{
return currentAttribute;
}
...
public static implicit operator Attribute (int v) => new Attribute (v);
...
Then Attribute.Value contains that
If that is not a problem, is ok!
If that is not a problem, is ok!
It's okay because if Attribute.Underline is true it's possible to extract from the value.
Should be that added to the Attribute.Value Property Get(). For example if someone have code like:
if (attr.Value > 100) {
...
}
Having Underline set, will always return true.
Having Underline set, will always return true.
Is true, but the user may check if Underline property is true and so the value isn't only colors, taking the desired action. But, normally, the user may take the colors by checking in the Background and Foreground colors.
We need to create an Issue for this set to point to the v2 Project (https://github.com/orgs/gui-cs/projects/1) and retarget this PR at the v2_develop branch.
This work should be merged into #2612. Closing.