- Better Syntax coloring

This commit is contained in:
Stone-Red-Code
2021-10-17 00:09:17 +02:00
parent e6d31c8277
commit 812b780942
9 changed files with 90 additions and 32 deletions
+2 -2
View File
@@ -206,7 +206,7 @@ namespace YesNt.CodeEditor
}
else
{
Console.WriteLine($"{sharedString} [{e.OriginalLine}] => [{e.CurrentLine}] ==>");
Console.WriteLine($"{sharedString}[{e.OriginalLine}] => [{e.CurrentLine}] ==>");
}
Console.ForegroundColor = ConsoleColor.Gray;
}
@@ -240,7 +240,7 @@ namespace YesNt.CodeEditor
return padding;
}
private Point oldSize = new Point(0, 0);
private readonly Point oldSize = new Point(0, 0);
private bool SizeChanged()
{
+37 -5
View File
@@ -37,19 +37,51 @@ namespace YesNt.CodeEditor
input = input.TrimEnd();
if (statement.SearchMode == SearchMode.StartOfLine && input.StartsWith(name))
{
input = AddColorInformation(input, input.Substring(0, name.Length), ConsoleColor.DarkGreen, statement.SearchMode);
if (statement.Seperator is not null && input.Contains(statement.Seperator))
{
input = AddColorInformation(input, statement.Seperator, statement.Color, SearchMode.StartOfLine);
}
else if (statement.Seperator is not null)
{
continue;
}
input = AddColorInformation(input, input.Substring(0, name.Length), statement.Color, statement.SearchMode);
}
if (statement.SearchMode == SearchMode.Contains && $"{input} ".Contains(name))
if (statement.SearchMode == SearchMode.Contains && $" {input} ".Contains(name))
{
input = AddColorInformation($"{input} ", $"{input} ".Substring($"{input} ".IndexOf(name), name.Length), ConsoleColor.Green, statement.SearchMode);
if (statement.Seperator is not null && input.Contains(statement.Seperator))
{
input = AddColorInformation(input, statement.Seperator, statement.Color, SearchMode.StartOfLine);
}
else if (statement.Seperator is not null)
{
continue;
}
input = AddColorInformation($"{input} ", $"{input} ".Substring($"{input} ".IndexOf(name), name.Length), statement.Color, statement.SearchMode);
}
if (statement.SearchMode == SearchMode.EndOfLine && input.EndsWith(name))
{
input = AddColorInformation(input, input.Substring(input.Length - name.Length), ConsoleColor.DarkYellow, statement.SearchMode);
if (statement.Seperator is not null && input.Contains(statement.Seperator))
{
input = AddColorInformation(input, statement.Seperator, statement.Color, SearchMode.StartOfLine);
}
else if (statement.Seperator is not null)
{
continue;
}
input = AddColorInformation(input, input.Substring(input.Length - name.Length), statement.Color, statement.SearchMode);
}
if (statement.SearchMode == SearchMode.Exact && input.Equals(name))
{
input = AddColorInformation(input, input, ConsoleColor.Red, statement.SearchMode);
if (statement.Seperator is not null && input.Contains(statement.Seperator))
{
input = AddColorInformation(input, statement.Seperator, statement.Color, SearchMode.StartOfLine);
}
else if (statement.Seperator is not null)
{
continue;
}
input = AddColorInformation(input, input, statement.Color, statement.SearchMode);
}
}