Add more statements and bug fixes

- Add `Execute(List<string>...` method to interpreter
- Add escape sequence (`!!`)
- Fix `Evaluator.Calulate` method not correctly handling `-` and `+` prefixes
This commit is contained in:
Stone_Red
2022-03-31 13:01:31 +02:00
parent 29bbcebf74
commit 510d2d910c
11 changed files with 101 additions and 41 deletions
+7 -3
View File
@@ -1,4 +1,5 @@
using System;
using System.Text;
namespace YesNt.CodeEditor
{
@@ -124,11 +125,14 @@ namespace YesNt.CodeEditor
textEditor.Lines.Add("");
}
while (textEditor.Lines[textEditor.CursorPosition.Y].Length <= textEditor.CursorPosition.X)
StringBuilder lineBuilder = new StringBuilder(textEditor.Lines[textEditor.CursorPosition.Y]);
while (lineBuilder.Length <= textEditor.CursorPosition.X)
{
textEditor.Lines[textEditor.CursorPosition.Y] += " ";
lineBuilder.Append(' ');
}
textEditor.Lines[textEditor.CursorPosition.Y] = lineBuilder.ToString();
if (keyInfo.Key == ConsoleKey.Backspace)
{
if (textEditor.CursorPosition.X > 0)
@@ -307,7 +311,7 @@ namespace YesNt.CodeEditor
return true;
}
public void WriteStatus(string input)
internal static void WriteStatus(string input)
{
Console.SetCursorPosition(0, Console.WindowHeight - 1);
Console.Write(input + new string(' ', Console.WindowWidth - input.Length - 1));