Skip to content

Commit

Permalink
fix: add vector header
Browse files Browse the repository at this point in the history
refactor: nits
  • Loading branch information
Tony Gorez committed Feb 26, 2024
1 parent b9be595 commit 3ed6626
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/prompt/include/qupp/prompt/prompt.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <optional>
#include <string>
#include <vector>

namespace qupp::prompt {

Expand Down
4 changes: 2 additions & 2 deletions src/prompt/unix/prompt.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "qupp/prompt/prompt.h"

#include <iostream> // std::cout, std::endl
#include <string> // std::string

Expand All @@ -25,13 +24,14 @@ StringResult Prompt::select_from_list(const std::string &question,
terminal_.enable_raw_mode();

for (const auto &option : options) {
bool is_last_option = options.back() == option;
bool is_first_option = options.front() == option;
if (is_first_option) {
terminal_.print_with_prefix("[*]", option, true);
} else {
terminal_.print_with_prefix("[ ]", option, true);
}

bool is_last_option = options.back() == option;
if (is_last_option) {
// Move cursor back to the first option.
terminal_.move_cursor_up(options.size());
Expand Down

0 comments on commit 3ed6626

Please sign in to comment.