So, I'm trying to create a terminal of sort in C#. I've chosen a rich text box for the "shell" area and basically every time the user presses enter I add a symbol for the meantime. The problem is, however, that the cursor instead of being ahead of the symbol is on a new line. Here is the simple code:
terminal.AppendText("\n>");
So, basically, if space here is |
then what I want is:
> |
but what I get is this:
>
|
I know this could have to do with the broader problem of how to add a new line when enter is pressed. What more is needed here?
Edit: The full code
if(e.KeyCode == Keys.Enter)
{
AddLine();
}
where AddLine()
is:
private void AddLine()
{
terminal.AppendText("\n>");
}
Reminder: terminal
is a rich text box in my windows form application. Also, the conditional statement is on the KeyDown()
method of the rich text box.