Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / ConsoleInterface / Menu.cpp
diff options
context:
space:
mode:
1 files changed, 3 insertions, 3 deletions
-rw-r--r--src/Generic/ConsoleInterface/Menu.cpp6
diff --git a/src/Generic/ConsoleInterface/Menu.cpp b/src/Generic/ConsoleInterface/Menu.cpp
index 69bb7b9..c053f93 100644
--- a/src/Generic/ConsoleInterface/Menu.cpp
+++ b/src/Generic/ConsoleInterface/Menu.cpp
@@ -4,8 +4,7 @@
Menu::Menu() : menuOptions() {}
-unsigned indexOfCommandEnd(char*& str) {
- while (*str == ' ') str++;
+unsigned indexOfCommandEnd(char* str) {
unsigned ind = 0;
while (str[ind] != ' ') ind++;
return ind;
@@ -31,10 +30,11 @@ void Menu::navigate() const {
char buffer[MAX_LINE_WIDTH];
- while (buffer != 0) {
+ while (strncmp(buffer, "quit", 4) != 0) {
clear();
inputLineBox("> ", buffer, MAX_LINE_WIDTH);
+ while (*buffer == ' ') buffer++;
unsigned commandEnd = indexOfCommandEnd(buffer),
index = menuOptions.get_count();
for (unsigned i = 0; i < menuOptions.get_count(); i++) {