[Teton] Buffer current command for executing.
This commit is contained in:
parent
c8e5441c7f
commit
faa54bc3dc
6 changed files with 42 additions and 20 deletions
20
sys/teton/terminal.cpp
Normal file
20
sys/teton/terminal.cpp
Normal 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>");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue