浏览代码

Fixes #418 and #931. Unix terminal hangs after exit. (#953)

* Fixes #931. Unix terminal hangs after exit.

* Changed escape sequence as suggested by @mklement0

* Changing as documented at http://ascii-table.com/ansi-escape-sequences-vt-100.php
BDisp 4 年之前
父节点
当前提交
c4e744a382
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs

+ 9 - 0
Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs

@@ -79,6 +79,7 @@ namespace Terminal.Gui {
 				TerminalResized?.Invoke ();
 				TerminalResized?.Invoke ();
 			}
 			}
 		}
 		}
+
 		public override void UpdateCursor () => Refresh ();
 		public override void UpdateCursor () => Refresh ();
 
 
 		public override void End ()
 		public override void End ()
@@ -95,6 +96,10 @@ namespace Terminal.Gui {
 			Console.Out.Flush ();
 			Console.Out.Flush ();
 			Console.Out.Write ("\x1b[1;25r");
 			Console.Out.Write ("\x1b[1;25r");
 			Console.Out.Flush ();
 			Console.Out.Flush ();
+
+			//Set cursor key to cursor.
+			Console.Out.Write("\x1b[?1l");
+			Console.Out.Flush();
 		}
 		}
 
 
 		public override void UpdateScreen () => window.redrawwin ();
 		public override void UpdateScreen () => window.redrawwin ();
@@ -693,6 +698,10 @@ namespace Terminal.Gui {
 				return;
 				return;
 
 
 			try {
 			try {
+				//Set cursor key to application.
+				Console.Out.Write ("\x1b[?1h");
+				Console.Out.Flush ();
+
 				window = Curses.initscr ();
 				window = Curses.initscr ();
 			} catch (Exception e) {
 			} catch (Exception e) {
 				Console.WriteLine ("Curses failed to initialize, the exception is: " + e);
 				Console.WriteLine ("Curses failed to initialize, the exception is: " + e);