瀏覽代碼

more cleanup

Tig Kindel 2 年之前
父節點
當前提交
4531eb00d2

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

@@ -143,19 +143,6 @@ namespace Terminal.Gui {
 			SetCursorVisibility (CursorVisibility.Default);
 
 			Curses.endwin ();
-
-			// I'm commenting this because was used in a trying to fix the Linux hanging and forgot to exclude it.
-			// Clear and reset entire screen.
-			//Console.Out.Write ("\x1b[2J");
-			//Console.Out.Flush ();
-
-			// Set top and bottom lines of a window.
-			//Console.Out.Write ("\x1b[1;25r");
-			//Console.Out.Flush ();
-
-			//Set cursor key to cursor.
-			//Console.Out.Write ("\x1b[?1l");
-			//Console.Out.Flush ();
 		}
 
 		public override void UpdateScreen () => window.redrawwin ();
@@ -168,8 +155,6 @@ namespace Terminal.Gui {
 
 		public Curses.Window window;
 
-		//static short last_color_pair = 16;
-
 		/// <summary>
 		/// Creates a curses color from the provided foreground and background colors
 		/// </summary>
@@ -782,7 +767,7 @@ namespace Terminal.Gui {
 			};
 		}
 
-		Curses.Event oldMouseEvents, reportableMouseEvents;
+		Curses.Event reportableMouseEvents;
 		public override void Init (Action terminalResized)
 		{
 			if (window != null)
@@ -839,7 +824,7 @@ namespace Terminal.Gui {
 			Curses.noecho ();
 
 			Curses.Window.Standard.keypad (true);
-			reportableMouseEvents = Curses.mousemask (Curses.Event.AllEvents | Curses.Event.ReportMousePosition, out oldMouseEvents);
+			reportableMouseEvents = Curses.mousemask (Curses.Event.AllEvents | Curses.Event.ReportMousePosition, out _);
 			TerminalResized = terminalResized;
 			if (reportableMouseEvents.HasFlag (Curses.Event.ReportMousePosition))
 				StartReportingMouseMoves ();
@@ -961,7 +946,7 @@ namespace Terminal.Gui {
 			case Color.White:
 				return Curses.COLOR_WHITE | Curses.A_BOLD | Curses.COLOR_GRAY;
 			case Color.Invalid:
-				return Curses.COLOR_BLACK; 
+				return Curses.COLOR_BLACK;
 			}
 			throw new ArgumentException ("Invalid color code");
 		}
@@ -1035,11 +1020,6 @@ namespace Terminal.Gui {
 			Console.Out.Flush ();
 		}
 
-		public override Attribute GetAttribute ()
-		{
-			return CurrentAttribute;
-		}
-
 		/// <inheritdoc/>
 		public override bool GetCursorVisibility (out CursorVisibility visibility)
 		{

+ 0 - 5
Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs

@@ -473,11 +473,6 @@ namespace Terminal.Gui {
 			keyUpHandler (new KeyEvent (map, keyModifiers));
 		}
 
-		public override Attribute GetAttribute ()
-		{
-			return CurrentAttribute;
-		}
-
 		/// <inheritdoc/>
 		public override bool GetCursorVisibility (out CursorVisibility visibility)
 		{

+ 0 - 5
Terminal.Gui/ConsoleDrivers/NetDriver.cs

@@ -1936,11 +1936,6 @@ namespace Terminal.Gui {
 			};
 		}
 
-		public override Attribute GetAttribute ()
-		{
-			return CurrentAttribute;
-		}
-
 		/// <inheritdoc/>
 		public override bool GetCursorVisibility (out CursorVisibility visibility)
 		{

+ 0 - 5
Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

@@ -1672,11 +1672,6 @@ namespace Terminal.Gui {
 			WinConsole = null;
 		}
 
-		public override Attribute GetAttribute ()
-		{
-			return CurrentAttribute;
-		}
-
 		/// <inheritdoc/>
 		public override bool GetCursorVisibility (out CursorVisibility visibility)
 		{

+ 3 - 3
Terminal.Gui/Core/ConsoleDriver.cs

@@ -177,7 +177,7 @@ namespace Terminal.Gui {
 	/// </para>
 	/// <para>
 	///   <see cref="Attribute"/>s are driver-specific and, as a result, are only valid if initialized by a <see cref="ConsoleDriver"/>.
-	///   If an <see cref="Attribute"/> is created before a driver is initialized <see cref="Initialized"/ will be <see langword="false"/>
+	///   If an <see cref="Attribute"/> is created before a driver is initialized <see cref="Initialized"/> will be <see langword="false"/>
 	///   and attempts to use the <see cref="Attribute"/> will result in an exception. To use an <see cref="Attribute"/> that is not
 	///   initilzied, after a driver is initialized, recreate the <see cref="Attribute"/> by calling the <see cref="Attribute"/> constructor
 	///   or <see cref="Make(Color, Color)"/>.
@@ -824,7 +824,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// The current attribute the driver is using. 
 		/// </summary>
-		public virtual Attribute CurrentAttribute {
+		internal virtual Attribute CurrentAttribute {
 			get => _currentAttribute; 
 			set {
 				if (!value.Initialized && value.HasValidColors && Application.Driver != null) {
@@ -1369,7 +1369,7 @@ namespace Terminal.Gui {
 		/// Gets the current <see cref="Attribute"/>.
 		/// </summary>
 		/// <returns>The current attribute.</returns>
-		public abstract Attribute GetAttribute ();
+		public Attribute GetAttribute () => CurrentAttribute;
 
 		/// <summary>
 		/// Make the <see cref="Colors"/> for the <see cref="ColorScheme"/>.