Multiple fixes: signed/unsigned, etc... (#600)

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
Marc
2023-03-26 20:20:02 +02:00
committed by GitHub
parent e177409bd3
commit eed7e2ea70
48 changed files with 215 additions and 144 deletions

View File

@@ -1,12 +1,13 @@
#include <algorithm> // for max, min
#include <cstddef> // for size_t
#include <functional> // for function
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <memory> // for __shared_ptr_access, allocator, shared_ptr
#include <string> // for string
#include "ftxui/component/component.hpp" // for Maybe, Checkbox, Make, Radiobox, Vertical, Dropdown
#include "ftxui/component/component_base.hpp" // for Component, ComponentBase
#include "ftxui/component/component_options.hpp" // for CheckboxOption, EntryState
#include "ftxui/dom/elements.hpp" // for operator|, Element, border, filler, operator|=, separator, size, text, vbox, frame, vscroll_indicator, hbox, HEIGHT, LESS_THAN, bold, inverted
#include "ftxui/screen/util.hpp" // for clamp
#include "ftxui/util/ref.hpp" // for ConstStringListRef
namespace ftxui {
@@ -38,8 +39,8 @@ Component Dropdown(ConstStringListRef entries, int* selected) {
}
Element Render() override {
*selected_ = std::min((int)entries_.size() - 1, std::max(0, *selected_));
title_ = entries_[*selected_];
*selected_ = util::clamp(*selected_, 0, (int)entries_.size() - 1);
title_ = entries_[static_cast<size_t>(*selected_)];
if (show_) {
const int max_height = 12;
return vbox({