@@ -16,9 +16,9 @@ public static class ConsoleIO
1616 private static LinkedList < string > previous = new LinkedList < string > ( ) ;
1717 private static string buffer = "" ;
1818 private static string buffer2 = "" ;
19- private static bool consolelock = false ;
2019 private static bool reading = false ;
21- private static bool writing = false ;
20+ private static bool reading_lock = false ;
21+ private static bool writing_lock = false ;
2222
2323 #region Read User Input
2424 public static string ReadLine ( )
@@ -32,8 +32,8 @@ public static string ReadLine()
3232 while ( k . Key != ConsoleKey . Enter )
3333 {
3434 k = Console . ReadKey ( true ) ;
35- while ( writing ) { }
36- consolelock = true ;
35+ while ( writing_lock ) { }
36+ reading_lock = true ;
3737 switch ( k . Key )
3838 {
3939 case ConsoleKey . Escape :
@@ -86,13 +86,15 @@ public static string ReadLine()
8686 Console . Write ( buffer ) ;
8787 }
8888 break ;
89+ case ConsoleKey . Tab :
90+ break ;
8991 default :
9092 AddChar ( k . KeyChar ) ;
9193 break ;
9294 }
93- consolelock = false ;
95+ reading_lock = false ;
9496 }
95- while ( writing ) { }
97+ while ( writing_lock ) { }
9698 reading = false ;
9799 previous . AddLast ( buffer + buffer2 ) ;
98100 return buffer + buffer2 ;
@@ -102,8 +104,8 @@ public static string ReadLine()
102104 #region Console Output
103105 public static void Write ( string text )
104106 {
105- while ( consolelock ) { }
106- writing = true ;
107+ while ( reading_lock ) { }
108+ writing_lock = true ;
107109 if ( reading )
108110 {
109111 ConsoleColor fore = Console . ForegroundColor ;
@@ -135,7 +137,7 @@ public static void Write(string text)
135137 Console . BackgroundColor = back ;
136138 }
137139 else Console . Write ( text ) ;
138- writing = false ;
140+ writing_lock = false ;
139141 }
140142
141143 public static void WriteLine ( string line )
@@ -179,15 +181,12 @@ private static void RemoveOneChar()
179181 }
180182 private static void GoBack ( )
181183 {
182- if ( buffer . Length > 0 )
184+ if ( Console . CursorLeft == 0 )
183185 {
184- if ( Console . CursorLeft == 0 )
185- {
186- Console . CursorLeft = Console . BufferWidth - 1 ;
187- Console . CursorTop -- ;
188- }
189- else Console . Write ( '\b ' ) ;
186+ Console . CursorLeft = Console . BufferWidth - 1 ;
187+ Console . CursorTop -- ;
190188 }
189+ else Console . Write ( '\b ' ) ;
191190 }
192191 private static void GoLeft ( )
193192 {
0 commit comments