From 49e3e3737c1f26846ef443f2621bbc2a552184c9 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 28 May 2022 20:30:07 +0300 Subject: Autocommit at 28.05.2022 @ 20:30 --- src/Generic/ConsoleInterface/Menu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Generic/ConsoleInterface/Menu.cpp') 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++) { -- cgit v1.3.1-23-gd82d