From 4531eb00d20f5617291145559e9ed30dfbc9af21 Mon Sep 17 00:00:00 2001 From: Tig Kindel Date: Mon, 6 Feb 2023 11:56:53 +0900 Subject: [PATCH] more cleanup --- .../CursesDriver/CursesDriver.cs | 26 +++---------------- .../ConsoleDrivers/FakeDriver/FakeDriver.cs | 5 ---- Terminal.Gui/ConsoleDrivers/NetDriver.cs | 5 ---- Terminal.Gui/ConsoleDrivers/WindowsDriver.cs | 5 ---- Terminal.Gui/Core/ConsoleDriver.cs | 6 ++--- 5 files changed, 6 insertions(+), 41 deletions(-) diff --git a/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs b/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs index 5702f6ba5..7d2b0b422 100644 --- a/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs +++ b/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; - /// /// Creates a curses color from the provided foreground and background colors /// @@ -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; - } - /// public override bool GetCursorVisibility (out CursorVisibility visibility) { diff --git a/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs b/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs index fcfa18c0b..3adbb7a23 100644 --- a/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs @@ -473,11 +473,6 @@ namespace Terminal.Gui { keyUpHandler (new KeyEvent (map, keyModifiers)); } - public override Attribute GetAttribute () - { - return CurrentAttribute; - } - /// public override bool GetCursorVisibility (out CursorVisibility visibility) { diff --git a/Terminal.Gui/ConsoleDrivers/NetDriver.cs b/Terminal.Gui/ConsoleDrivers/NetDriver.cs index c9236de22..485a06f6e 100644 --- a/Terminal.Gui/ConsoleDrivers/NetDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/NetDriver.cs @@ -1936,11 +1936,6 @@ namespace Terminal.Gui { }; } - public override Attribute GetAttribute () - { - return CurrentAttribute; - } - /// public override bool GetCursorVisibility (out CursorVisibility visibility) { diff --git a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs index 16692f966..9b0568a62 100644 --- a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs @@ -1672,11 +1672,6 @@ namespace Terminal.Gui { WinConsole = null; } - public override Attribute GetAttribute () - { - return CurrentAttribute; - } - /// public override bool GetCursorVisibility (out CursorVisibility visibility) { diff --git a/Terminal.Gui/Core/ConsoleDriver.cs b/Terminal.Gui/Core/ConsoleDriver.cs index 9b7adf001..e0f52ccc6 100644 --- a/Terminal.Gui/Core/ConsoleDriver.cs +++ b/Terminal.Gui/Core/ConsoleDriver.cs @@ -177,7 +177,7 @@ namespace Terminal.Gui { /// /// /// s are driver-specific and, as a result, are only valid if initialized by a . - /// If an is created before a driver is initialized + /// If an is created before a driver is initialized will be /// and attempts to use the will result in an exception. To use an that is not /// initilzied, after a driver is initialized, recreate the by calling the constructor /// or . @@ -824,7 +824,7 @@ namespace Terminal.Gui { /// /// The current attribute the driver is using. /// - 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 . /// /// The current attribute. - public abstract Attribute GetAttribute (); + public Attribute GetAttribute () => CurrentAttribute; /// /// Make the for the .