[Teton] Buffer current command for executing.

This commit is contained in:
Drew Galbraith 2023-11-26 13:39:39 -08:00
parent c8e5441c7f
commit faa54bc3dc
6 changed files with 42 additions and 20 deletions

20
sys/teton/terminal.cpp Normal file
View file

@ -0,0 +1,20 @@
#include "terminal.h"
void Terminal::HandleCharacter(char c) {
console_.WriteChar(c);
if (c == '\n') {
glcr::String str = current_command_.ToString();
ExecuteCommand(str);
current_command_.Reset();
} else if (c == '\b') {
current_command_.DeleteLast();
} else {
current_command_.PushBack(c);
}
}
void Terminal::ExecuteCommand(const glcr::String& command) {
console_.WriteString("Executing: ");
console_.WriteString(command);
console_.WriteString("\n>");
}