mirror of
https://github.com/Stone-Red-Code/YesNt-Interpreter.git
synced 2026-09-04 09:06:41 +02:00
Improve code formatting
This commit is contained in:
@@ -23,7 +23,7 @@ namespace YesNt.CodeEditor
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
Load(path);
|
||||
_ = Load(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,14 +131,7 @@ namespace YesNt.CodeEditor
|
||||
|
||||
if (CurrentPath.Trim() != path.Trim() && loadIfExists)
|
||||
{
|
||||
if (Load(path))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Load(path);
|
||||
}
|
||||
if (string.IsNullOrEmpty(Path.GetExtension(path)))
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace YesNt.CodeEditor
|
||||
{
|
||||
while (Console.KeyAvailable)
|
||||
{
|
||||
Console.ReadKey(true);
|
||||
_ = Console.ReadKey(true);
|
||||
}
|
||||
if (textEditor.EditMode == Mode.Edit)
|
||||
{
|
||||
@@ -50,14 +50,7 @@ namespace YesNt.CodeEditor
|
||||
return true;
|
||||
|
||||
case ConsoleKey.E:
|
||||
if (textEditor.Lines.Count > textEditor.CursorPosition.Y)
|
||||
{
|
||||
textEditor.CursorPosition.X = textEditor.Lines[textEditor.CursorPosition.Y].TrimEnd().Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
textEditor.CursorPosition.X = 0;
|
||||
}
|
||||
textEditor.CursorPosition.X = textEditor.Lines.Count > textEditor.CursorPosition.Y ? textEditor.Lines[textEditor.CursorPosition.Y].TrimEnd().Length : 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +121,7 @@ namespace YesNt.CodeEditor
|
||||
StringBuilder lineBuilder = new StringBuilder(textEditor.Lines[textEditor.CursorPosition.Y]);
|
||||
while (lineBuilder.Length <= textEditor.CursorPosition.X)
|
||||
{
|
||||
lineBuilder.Append(' ');
|
||||
_ = lineBuilder.Append(' ');
|
||||
}
|
||||
|
||||
textEditor.Lines[textEditor.CursorPosition.Y] = lineBuilder.ToString();
|
||||
@@ -228,7 +221,7 @@ namespace YesNt.CodeEditor
|
||||
break;
|
||||
|
||||
case "save":
|
||||
textEditor.Save(input, false);
|
||||
_ = textEditor.Save(input, false);
|
||||
break;
|
||||
|
||||
case "run":
|
||||
@@ -240,9 +233,9 @@ namespace YesNt.CodeEditor
|
||||
textEditor.YesNtInterpreter.Execute(textEditor.CurrentPath);
|
||||
while (Console.KeyAvailable)
|
||||
{
|
||||
Console.ReadKey(true);
|
||||
_ = Console.ReadKey(true);
|
||||
}
|
||||
Console.ReadKey();
|
||||
_ = Console.ReadKey();
|
||||
WriteStatus(string.Empty);
|
||||
textEditor.EditMode = Mode.Command;
|
||||
}
|
||||
@@ -257,9 +250,9 @@ namespace YesNt.CodeEditor
|
||||
textEditor.YesNtInterpreter.Execute(textEditor.CurrentPath, true);
|
||||
while (Console.KeyAvailable)
|
||||
{
|
||||
Console.ReadKey(true);
|
||||
_ = Console.ReadKey(true);
|
||||
}
|
||||
Console.ReadKey();
|
||||
_ = Console.ReadKey();
|
||||
WriteStatus(string.Empty);
|
||||
textEditor.EditMode = Mode.Command;
|
||||
}
|
||||
@@ -278,7 +271,7 @@ namespace YesNt.CodeEditor
|
||||
|
||||
try
|
||||
{
|
||||
textEditor.Load(path);
|
||||
_ = textEditor.Load(path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -4,17 +4,7 @@
|
||||
{
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
TextEditor textEditor;
|
||||
|
||||
if (args.Length > 0)
|
||||
{
|
||||
textEditor = new TextEditor(args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
textEditor = new TextEditor();
|
||||
}
|
||||
|
||||
TextEditor textEditor = args.Length > 0 ? new TextEditor(args[0]) : new TextEditor();
|
||||
textEditor.Run();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user