[Mono-bugs] [Bug 80330][Nor] New - TermInfoDriver ForegroundColor and BackgroundColor don't reflect initial colors

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Dec 20 11:32:52 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by moritz.kroll at gmx.de.

http://bugzilla.ximian.com/show_bug.cgi?id=80330

--- shadow/80330	2006-12-20 11:32:52.000000000 -0500
+++ shadow/80330.tmp.10908	2006-12-20 11:32:52.000000000 -0500
@@ -0,0 +1,66 @@
+Bug#: 80330
+Product: Mono: Class Libraries
+Version: 1.2
+OS: SUSE 9.2
+OS Details: Suse 9.3 on Pentium4 2400
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: Moritz.Kroll at gmx.de               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: TermInfoDriver ForegroundColor and BackgroundColor don't reflect initial colors
+
+Description of Problem:
+If you want to highlight something on the console, you'll probably change 
+the color, write something, and change back to the old color.
+The problem is, that Console.ForegroundColor -> 
+TermInfoDriver.ForegroundColor defaults to ConsoleColor.White and the 
+Console.BackgroundColor -> TermInfoDriver.BackgroundColor to 
+ConsoleColor.Black no matter what the color actually is. Therefore 
+the "change back" part may lead to white on bright yellow text (as in my 
+case with xterm).
+
+Steps to reproduce the problem:
+Execute the following program:
+-----------
+using System;
+
+namespace MonoConsoleTest
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            Console.WriteLine("normal");
+            ConsoleColor oldCol = Console.ForegroundColor;
+            Console.ForegroundColor = ConsoleColor.Red;
+            Console.WriteLine("highlight");
+            Console.ForegroundColor = oldCol;
+            Console.WriteLine("back to normal");
+        }
+    }
+}
+-----------
+
+Actual Results:
+"back to normal" is as good as invisible, if your background color is very 
+bright, as the foreground color is white.
+
+Expected Results:
+"back to normal" appears in your standard foreground color (in my case 
+black).
+
+How often does this happen? 
+Always
+
+Additional Information:
+Mono version: 1.2.2.1
+
+This appears to be no problem in Windows, as some kind of color mapping is 
+applied if you change the console colors of the cmd.exe.


More information about the mono-bugs mailing list