- Improve debug output

This commit is contained in:
Stone-Red-Code
2021-10-14 15:03:44 +02:00
parent 80fda48944
commit e6d31c8277
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -197,17 +197,18 @@ namespace YesNt.CodeEditor
{ {
Console.ForegroundColor = ConsoleColor.Magenta; 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) if (e.OriginalLine == e.CurrentLine)
{ {
Console.WriteLine($"{Environment.NewLine}{taskId}[{e.LineNumber}] [{e.CurrentLine}] ==>"); Console.WriteLine($"{sharedString}[{e.CurrentLine}] ==>");
} }
else else
{ {
Console.WriteLine($"{Environment.NewLine}{taskId}[{e.LineNumber}] [{e.OriginalLine}] => [{e.CurrentLine}] ==>"); Console.WriteLine($"{sharedString} [{e.OriginalLine}] => [{e.CurrentLine}] ==>");
} }
Console.ForegroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray;
} }
string[] outputs = debugOutput.ToArray(); string[] outputs = debugOutput.ToArray();
debugOutput.Clear(); debugOutput.Clear();
+1 -1
View File
@@ -4,7 +4,7 @@ namespace YesNt.CodeEditor
{ {
internal class InputHandler internal class InputHandler
{ {
private TextEditor textEditor; private readonly TextEditor textEditor;
public InputHandler(TextEditor textEditor) public InputHandler(TextEditor textEditor)
{ {