aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlempamo <[email protected]>2017-09-24 15:20:59 -0400
committerlempamo <[email protected]>2017-09-24 15:20:59 -0400
commit18b78b05bceeab3299a93ee1ec769a48c59c36c3 (patch)
tree16c09c975b8b0c3b1b33dc3f40c1ab069e9a9843
parent9e96ca19ed0904e7c80496071b0d7efdde405414 (diff)
parent5a22c8aa92ba3de29bfe9a674441655736105095 (diff)
downloadhistacom2-18b78b05bceeab3299a93ee1ec769a48c59c36c3.tar.gz
histacom2-18b78b05bceeab3299a93ee1ec769a48c59c36c3.tar.bz2
histacom2-18b78b05bceeab3299a93ee1ec769a48c59c36c3.zip
Merge branch 'master' of https://github.com/Histacom2-Devs/Histacom2.git
-rw-r--r--Histacom2/OS/Win95/Win95Apps/WinClassicTerminal.cs28
1 files changed, 21 insertions, 7 deletions
diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicTerminal.cs b/Histacom2/OS/Win95/Win95Apps/WinClassicTerminal.cs
index 668078e..d87dc4e 100644
--- a/Histacom2/OS/Win95/Win95Apps/WinClassicTerminal.cs
+++ b/Histacom2/OS/Win95/Win95Apps/WinClassicTerminal.cs
@@ -28,7 +28,7 @@ namespace Histacom2.OS.Win95.Win95Apps
public static string prefix = @"C:\WINDOWS>";
public static string workingDir = $"{SaveSystem.ProfileWindowsDirectory}";
public string output = "";
-
+ public bool cls = false;
public WinClassicTerminal(bool readOnly)
{
InitializeComponent();
@@ -107,9 +107,10 @@ namespace Histacom2.OS.Win95.Win95Apps
{
//TODO: Add font UC(?)
}
-
+
private void richTextBox1_KeyUp(object sender, KeyEventArgs e)
{
+
if (e.KeyData == Keys.Return)
{
string[] cmd = cmdPrompt.Lines[currentLine].Substring(prefix.Length).Split(' ');
@@ -152,6 +153,12 @@ namespace Histacom2.OS.Win95.Win95Apps
output += dline;
break;
+ case "cls":
+ currentLine = 0;
+ cmdPrompt.Clear();
+ cls = true;
+ output = prefix;
+ break;
default:
// Temporary CMD redirect
/*
@@ -174,11 +181,18 @@ namespace Histacom2.OS.Win95.Win95Apps
cmdPrompt.Focus();
cmdPrompt.AppendText($"\n{output}"); // Append the command output
-
- int numLines = output.Split('\n').Length; // Get the number of lines from the command output
- currentLine = currentLine + 2 + numLines; // Set the current line to equals the previous line plus 2 plus the number of lines from the command
-
- cmdPrompt.AppendText($"\n\n{prefix}"); // Append the text to the RichTextBox
+ string[] stringSeparators = new string[] { "\n" };
+ string[] lines = output.Split(stringSeparators, StringSplitOptions.None);
+ foreach (string s in lines)
+ {
+ currentLine++;
+ }
+ if (!cls)
+ {
+ cmdPrompt.AppendText($"\n\n{prefix}"); // Append the text to the RichTextBox
+ currentLine = currentLine + 3;
+ }
+ cls = false;
}
}
}