yay mostly working terminal

This commit is contained in:
FloppyDiskDrive 2017-11-21 17:47:37 -06:00
parent 170aebeb68
commit 04ce34c099
2 changed files with 11 additions and 4 deletions

View file

@ -2,6 +2,8 @@
using System.Windows.Forms; using System.Windows.Forms;
using ShiftOS.Engine; using ShiftOS.Engine;
using ShiftOS.Main.Terminal; using ShiftOS.Main.Terminal;
using System.Linq;
using System.Collections.Generic;
namespace ShiftOS.Main.ShiftOS.Apps namespace ShiftOS.Main.ShiftOS.Apps
{ {
@ -14,6 +16,7 @@ namespace ShiftOS.Main.ShiftOS.Apps
public bool RunningCommand = false; public bool RunningCommand = false;
public bool WaitingResponse = false; public bool WaitingResponse = false;
public string InputReturnText = ""; public string InputReturnText = "";
public List<string> c = TerminalBackend.commandBuffer;
// The below variables makes the terminal... a terminal! // The below variables makes the terminal... a terminal!
string OldText = ""; string OldText = "";
@ -127,6 +130,11 @@ namespace ShiftOS.Main.ShiftOS.Apps
Print(); Print();
e.Handled = true; e.Handled = true;
} }
} else if (e.KeyCode == Keys.Up)
{
if (c.Count == 0) return;
termmain.AppendText(c.Last());
}
}
} }
} }

View file

@ -17,6 +17,7 @@ namespace ShiftOS.Main.Terminal
public static List<ShiftOS.Apps.Terminal> trm = new List<ShiftOS.Apps.Terminal>(); public static List<ShiftOS.Apps.Terminal> trm = new List<ShiftOS.Apps.Terminal>();
public static int trmTopID = 0; public static int trmTopID = 0;
public static List<string> commandBuffer = new List<string>();
/// <summary> /// <summary>
/// Runs a terminal command. /// Runs a terminal command.
/// </summary> /// </summary>
@ -40,6 +41,7 @@ namespace ShiftOS.Main.Terminal
Array.Find(trm.ToArray(), w => w.TerminalID == TermID).termmain.AppendText("\n"); Array.Find(trm.ToArray(), w => w.TerminalID == TermID).termmain.AppendText("\n");
instance.Run(theParams); instance.Run(theParams);
complete = true; complete = true;
commandBuffer.Add(command);
return; return;
} }
} }
@ -48,9 +50,6 @@ namespace ShiftOS.Main.Terminal
Array.Find(trm.ToArray(), w => w.TerminalID == TermID).termmain.AppendText($"\n sbash: invalid command: {command.Split(' ').First()}"); Array.Find(trm.ToArray(), w => w.TerminalID == TermID).termmain.AppendText($"\n sbash: invalid command: {command.Split(' ').First()}");
return; return;
} }
Array.Find(trm.ToArray(), w => w.TerminalID == TermID).termmain.Text += " \n The command cannot be found. \n"; Array.Find(trm.ToArray(), w => w.TerminalID == TermID).termmain.Text += " \n The command cannot be found. \n";
} }
} }