[Mono-bugs] [Bug 79319][Nor] Changed - Console.SetCursorPosition doesn't set the cursor to a remembered position

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Apr 17 17:17:22 EDT 2007


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 fejj at novell.com.

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

--- shadow/79319	2007-04-17 17:08:44.000000000 -0400
+++ shadow/79319.tmp.3494	2007-04-17 17:17:22.000000000 -0400
@@ -78,6 +78,44 @@
 buffer up. Meaning that /now/, even though iTop is 23, the /real/
 position of that line is actually line 21 (at best! - assuming the
 user didn't type some number of lines of text before actually hitting
 the Enter key).
 
 So... I'm not sure what to do about this.
+
+------- Additional Comments From fejj at novell.com  2007-04-17 17:17 -------
+here's the correct implementation of what you are trying to do:
+
+using System;
+
+namespace mano
+{
+	class MainClass
+	{
+		public static void Main(string[] args)
+		{
+			int x, y, y1;
+			
+			Console.WriteLine("__MONO BUG TESTCASE__");
+			Console.Write("String to be changed: ");
+			x = Console.CursorLeft;
+			y1 = y = Console.CursorTop;
+			Console.WriteLine("FIRST_VALUE");
+			if (Console.CursorTop == y1) {
+				// means we scrolled
+				y--;
+			}
+			Console.WriteLine("Now, after pressing any key, the String will
+change");
+			if (Console.CursorTop == y1) {
+				// means we scrolled
+				y--;
+			}
+			
+			Console.ReadKey (true);
+			
+			Console.SetCursorPosition(x, y);
+			Console.WriteLine("SECOND_VALUE");
+		}
+	}
+}
+


More information about the mono-bugs mailing list