-
Notifications
You must be signed in to change notification settings - Fork 689
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
Fixes #1358. Attribute.Foreground / Attribute.Background now working with CursesDriver #1359
Conversation
…rking with CursesDriver
I don't know what going here. |
Looks like there are a lot of failed calls to The error message seems to crop up a lot in real life (i.e. outside of CI) and be associated with the variable $TERM not being defined (also here) It is also the commit that introduces |
In the last commit I didn't see any error caused by the Normally I need to export
Yes, is the first time and maybe the environment is not properly prepared to run a terminal in the server image. But I'll need some help for this, please. Thanks. |
Ok I have enabled GitHub Actions in my fork of the repo (actions are disabled by default in forks) and have created a minimum repro of the issue: Its a PR from a branch to main in my repo because the build test workflow seemed to want that in order to run. I'll do a bit of exploring but I've also noticed that |
With the |
Yup, seems as soon as you call I tried setting environment variable TERM but didn't help and felt hacky anyway. |
It looks like it will have to be. Do you think I should also discard all changes to the drivers? |
Its up to you, I think the important thing is to fix the Foreground/Background color issue itself which is what this PR does. I think changing Constructor/Init logic is something else and if it was only done to delay the 'error creating a handle' exception then we probably don't need/want that behaviour change. |
c0da8ff
to
f256046
Compare
Great stuff! I had a little play around with your InvertColors scenario to make it cooler. If you don't like it you can ignore it: List<Label> labels = new List<Label> ();
var foreColors = Enum.GetValues (typeof (Color)).Cast<Color> ().ToArray ();
for (int y = 0; y < foreColors.Length; y++) {
var fore = foreColors [y];
var back = foreColors [(y + 1) % foreColors.Length];
var color = Application.Driver.MakeAttribute (fore, back);
var label = new Label ($"{fore} on {back}") {
ColorScheme = new ColorScheme (),
Y = y
};
label.ColorScheme.Normal = color;
Win.Add (label);
labels.Add (label);
}
var button = new Button ("Invert color!") {
X = Pos.Center (),
Y = foreColors.Length+1,
};
button.Clicked += () => {
foreach(var label in labels) {
var color = label.ColorScheme.Normal;
color = Application.Driver.MakeAttribute (color.Background, color.Foreground);
label.ColorScheme.Normal = color;
label.Text = $"{color.Foreground} on {color.Background}";
label.SetNeedsDisplay ();
}
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
To allowing some test on some specifics
ConsoleDriver
features, the initialization should be done in the Init method (ConsoleDriver
) and in theSetup
(IMainLoopDriver
), instead in the constructors.