From e6d31c8277433b207e55d4aaef68f1e9ee3aee11 Mon Sep 17 00:00:00 2001 From: Stone-Red-Code <56473591+Stone-Red-Code@users.noreply.github.com> Date: Thu, 14 Oct 2021 15:03:44 +0200 Subject: [PATCH] - Improve debug output --- YesNt.CodeEditor/Editor.cs | 9 +++++---- YesNt.CodeEditor/InputHandler.cs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/YesNt.CodeEditor/Editor.cs b/YesNt.CodeEditor/Editor.cs index fa9f793..d67e015 100644 --- a/YesNt.CodeEditor/Editor.cs +++ b/YesNt.CodeEditor/Editor.cs @@ -197,17 +197,18 @@ namespace YesNt.CodeEditor { Console.ForegroundColor = ConsoleColor.Magenta; - string taskId = e.IsTask ? $"[Task: {e.TaskId}] " : string.Empty; + string sharedString = (Console.CursorLeft != 0) ? Environment.NewLine : string.Empty; + sharedString += e.IsTask ? $"[Task: {e.TaskId}] " : string.Empty + $"[{e.LineNumber}]"; + if (e.OriginalLine == e.CurrentLine) { - Console.WriteLine($"{Environment.NewLine}{taskId}[{e.LineNumber}] [{e.CurrentLine}] ==>"); + Console.WriteLine($"{sharedString}[{e.CurrentLine}] ==>"); } else { - Console.WriteLine($"{Environment.NewLine}{taskId}[{e.LineNumber}] [{e.OriginalLine}] => [{e.CurrentLine}] ==>"); + Console.WriteLine($"{sharedString} [{e.OriginalLine}] => [{e.CurrentLine}] ==>"); } Console.ForegroundColor = ConsoleColor.Gray; - } string[] outputs = debugOutput.ToArray(); debugOutput.Clear(); diff --git a/YesNt.CodeEditor/InputHandler.cs b/YesNt.CodeEditor/InputHandler.cs index a72f0d7..3ec8ee6 100644 --- a/YesNt.CodeEditor/InputHandler.cs +++ b/YesNt.CodeEditor/InputHandler.cs @@ -4,7 +4,7 @@ namespace YesNt.CodeEditor { internal class InputHandler { - private TextEditor textEditor; + private readonly TextEditor textEditor; public InputHandler(TextEditor textEditor) {