浏览代码

Use Curses.flushinp to throws away any typeahead.

BDisp 2 年之前
父节点
当前提交
281f470aa4
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs

+ 3 - 4
Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs

@@ -160,10 +160,9 @@ namespace Terminal.Gui {
 			StopReportingMouseMoves ();
 			StopReportingMouseMoves ();
 			SetCursorVisibility (CursorVisibility.Default);
 			SetCursorVisibility (CursorVisibility.Default);
 
 
-			var code = Curses.get_wch (out _);
-			while (code != -1) {
-				code = Curses.get_wch (out _);
-			}
+			// throws away any typeahead that has been typed by
+			// the user and has not yet been read by the program.
+			Curses.flushinp ();
 
 
 			Curses.endwin ();
 			Curses.endwin ();
 		}
 		}