From 8c689d79196d809f741b5580907d5326682c3aaa Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 6 May 2022 11:56:58 +0300 Subject: Autocommit at 06.05.2022 @ 11:56 --- src/ConsoleInterface/Menu.cpp | 2 +- src/ConsoleInterface/Toolbox.cpp | 18 ++++++++++++------ src/ConsoleInterface/Toolbox.hpp | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src/ConsoleInterface') diff --git a/src/ConsoleInterface/Menu.cpp b/src/ConsoleInterface/Menu.cpp index caba7e8..0b27d48 100644 --- a/src/ConsoleInterface/Menu.cpp +++ b/src/ConsoleInterface/Menu.cpp @@ -77,7 +77,7 @@ void Menu::navigate() const { for (unsigned i = 0; i < menuOptions.get_count(); i++) printOrderedListElem(menuOptions[i].get_nameInMenu()); - _printAltInputBoxLabel("Execute No [0-"); + _printInputBoxLabel("Execute No [0-"); print(menuOptions.get_count()); print("]: "); read(buffer); diff --git a/src/ConsoleInterface/Toolbox.cpp b/src/ConsoleInterface/Toolbox.cpp index fc871ae..11ab374 100644 --- a/src/ConsoleInterface/Toolbox.cpp +++ b/src/ConsoleInterface/Toolbox.cpp @@ -74,20 +74,26 @@ void _printOrderedListBeginning() { std::cout << "[" << orderedListIndex++ << "] "; } -void _printInputBoxSubLabel(const char* label) { - std::cout << " (+) " << label; -} - void _printInputBoxLabel(const char* label) { std::cout << "(+) " << label; } -void inputLineBox(const char* label, char* output, unsigned maxWidth) { +void _printInputBoxSubLabel(const char* label) { + std::cout << " "; _printInputBoxLabel(label); +} + +void __inputLineBoxGetInput(char* output, unsigned maxWidth) { std::cin.ignore(); std::cin.getline(output, maxWidth); } -void inputLineSubBox(const char* label, char* output, unsigned maxWidth) { +void inputLineBox(const char* label, char* output, unsigned maxWidth) { + _printInputBoxLabel(label); + __inputLineBoxGetInput(output, maxWidth); +} +void inputLineSubBox(const char* label, char* output, unsigned maxWidth) { + _printInputBoxSubLabel(label); + __inputLineBoxGetInput(output, maxWidth); } diff --git a/src/ConsoleInterface/Toolbox.hpp b/src/ConsoleInterface/Toolbox.hpp index 2844682..ed5d6ac 100644 --- a/src/ConsoleInterface/Toolbox.hpp +++ b/src/ConsoleInterface/Toolbox.hpp @@ -17,10 +17,11 @@ void errorBox(const char* message); void table(unsigned startNumber, unsigned columns, const char* items); void inputLineBox(const char* label, char* output, unsigned maxWidth); +void inputLineSubBox(const char* label, char* output, unsigned maxWidth); void resetOrderedList(int starter = 1); void _printInputBoxLabel(const char* label); -void _printInputBoxSubLabel(const char* label); +void _printInputSubBoxLabel(const char* label); void _printOrderedListBeginning(); template -- cgit v1.3.1-23-gd82d