From 4abc39d48b0f768cb69c7e7a13c6784ad775c801 Mon Sep 17 00:00:00 2001 From: JFronny <33260128+JFronny@users.noreply.github.com> Date: Fri, 12 Jun 2020 15:40:08 +0200 Subject: [PATCH] I don't know how it works, I don't want to know but it works so I won't touch it from now --- CLITest/Program.cs | 5 +++++ Commandline/TUI/DiffDraw.cs | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CLITest/Program.cs b/CLITest/Program.cs index 90f2728..798a0fd 100644 --- a/CLITest/Program.cs +++ b/CLITest/Program.cs @@ -79,6 +79,11 @@ namespace CLITest } Console.ResetColor(); Console.Clear(); + Console.WriteLine("Test2"); + Thread.Sleep(100); + DiffDraw.Clear(10, 10); + DiffDraw.Draw(true, false); + Console.Clear(); Console.WriteLine("Bye"); } } diff --git a/Commandline/TUI/DiffDraw.cs b/Commandline/TUI/DiffDraw.cs index 6ee50d7..78c1197 100644 --- a/Commandline/TUI/DiffDraw.cs +++ b/Commandline/TUI/DiffDraw.cs @@ -40,13 +40,13 @@ namespace CC_Functions.Commandline.TUI { for (int x = 0; x < width; x++) { - Pixel? tmp1 = Screen[y, x]; - if (full && tmp1 == _last[y, x]) continue; - if (tmp1 != null && color) + Pixel tmp1 = Screen[y, x]; + if (!full && tmp1 == _last[y, x]) continue; + if (ReferenceEquals(tmp1, null) && color) { - if (Console.ForegroundColor != tmp1.ForeColor) + if (Console.ForegroundColor != tmp1?.ForeColor && tmp1?.ForeColor != null) Console.ForegroundColor = tmp1.ForeColor; - if (Console.BackgroundColor != tmp1.BackColor) + if (Console.BackgroundColor != tmp1?.BackColor && tmp1?.ForeColor != null) Console.BackgroundColor = tmp1.BackColor; } Console.CursorLeft = x;