Generate compile commands for clangd. (#855)

Fix all the diagnostics reported.

Bug: https://github.com/ArthurSonzogni/FTXUI/issues/828
This commit is contained in:
Arthur Sonzogni 2024-05-01 11:40:49 +02:00 committed by ArthurSonzogni
parent 6a755f3760
commit 8a2a9b0799
No known key found for this signature in database
GPG Key ID: 41D98248C074CD6C
81 changed files with 161 additions and 209 deletions

View File

@ -27,6 +27,8 @@ else()
${FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT} OFF) ${FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT} OFF)
endif() endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(cmake/ftxui_message.cmake) include(cmake/ftxui_message.cmake)
add_library(screen add_library(screen

View File

@ -32,7 +32,7 @@ A simple cross-platform C++ library for terminal based user interfaces!
## Feature ## Feature
* Functional style. Inspired by * Functional style. Inspired by
[[1]](https://hackernoon.com/building-reactive-terminal-interfaces-in-c-d392ce34e649?gi=d9fb9ce35901) [1](https://hackernoon.com/building-reactive-terminal-interfaces-in-c-d392ce34e649?gi=d9fb9ce35901)
and [React](https://reactjs.org/) and [React](https://reactjs.org/)
* Simple and elegant syntax (in my opinion) * Simple and elegant syntax (in my opinion)
* Keyboard & mouse navigation. * Keyboard & mouse navigation.

View File

@ -7,11 +7,7 @@
#include <chrono> // for milliseconds, duration, steady_clock, time_point #include <chrono> // for milliseconds, duration, steady_clock, time_point
#include <functional> // for function #include <functional> // for function
#include "ftxui/component/event.hpp" namespace ftxui::animation {
namespace ftxui {
namespace animation {
// Components who haven't completed their animation can call this function to // Components who haven't completed their animation can call this function to
// request a new frame to be drawn later. // request a new frame to be drawn later.
// //
@ -26,7 +22,7 @@ using Duration = std::chrono::duration<float>;
// Parameter of Component::OnAnimation(param). // Parameter of Component::OnAnimation(param).
class Params { class Params {
public: public:
Params(Duration duration) : duration_(duration) {} explicit Params(Duration duration) : duration_(duration) {}
/// The duration this animation step represents. /// The duration this animation step represents.
Duration duration() const { return duration_; } Duration duration() const { return duration_; }
@ -93,11 +89,11 @@ float BounceInOut(float p);
class Animator { class Animator {
public: public:
Animator(float* from, explicit Animator(float* from,
float to = 0.f, float to = 0.f,
Duration duration = std::chrono::milliseconds(250), Duration duration = std::chrono::milliseconds(250),
easing::Function easing_function = easing::Linear, easing::Function easing_function = easing::Linear,
Duration delay = std::chrono::milliseconds(0)); Duration delay = std::chrono::milliseconds(0));
void OnAnimation(Params&); void OnAnimation(Params&);
@ -112,7 +108,6 @@ class Animator {
Duration current_; Duration current_;
}; };
} // namespace animation } // namespace ftxui::animation
} // namespace ftxui
#endif /* end of include guard: FTXUI_ANIMATION_HPP */ #endif /* end of include guard: FTXUI_ANIMATION_HPP */

View File

@ -9,6 +9,11 @@
namespace ftxui { namespace ftxui {
class CapturedMouseInterface { class CapturedMouseInterface {
public: public:
CapturedMouseInterface() = default;
CapturedMouseInterface(const CapturedMouseInterface&) = default;
CapturedMouseInterface(CapturedMouseInterface&&) = delete;
CapturedMouseInterface& operator=(const CapturedMouseInterface&) = default;
CapturedMouseInterface& operator=(CapturedMouseInterface&&) = delete;
virtual ~CapturedMouseInterface() = default; virtual ~CapturedMouseInterface() = default;
}; };
using CapturedMouse = std::unique_ptr<CapturedMouseInterface>; using CapturedMouse = std::unique_ptr<CapturedMouseInterface>;

View File

@ -6,9 +6,7 @@
#include <functional> // for function #include <functional> // for function
#include <memory> // for make_shared, shared_ptr #include <memory> // for make_shared, shared_ptr
#include <string> // for wstring
#include <utility> // for forward #include <utility> // for forward
#include <vector> // for vector
#include "ftxui/component/component_base.hpp" // for Component, Components #include "ftxui/component/component_base.hpp" // for Component, Components
#include "ftxui/component/component_options.hpp" // for ButtonOption, CheckboxOption, MenuOption #include "ftxui/component/component_options.hpp" // for ButtonOption, CheckboxOption, MenuOption
@ -96,9 +94,9 @@ Component Slider(ConstStringRef label,
ConstRef<float> increment = 5.f); ConstRef<float> increment = 5.f);
Component Slider(ConstStringRef label, Component Slider(ConstStringRef label,
Ref<long> value, Ref<long> value,
ConstRef<long> min = 0l, ConstRef<long> min = 0L,
ConstRef<long> max = 100l, ConstRef<long> max = 100L,
ConstRef<long> increment = 5l); ConstRef<long> increment = 5L);
Component ResizableSplit(ResizableSplitOption options); Component ResizableSplit(ResizableSplitOption options);
Component ResizableSplitLeft(Component main, Component back, int* main_size); Component ResizableSplitLeft(Component main, Component back, int* main_size);

View File

@ -29,14 +29,16 @@ using Components = std::vector<Component>;
/// @ingroup component /// @ingroup component
class ComponentBase { class ComponentBase {
public: public:
// virtual Destructor. explicit ComponentBase(Components children)
: children_(std::move(children)) {}
virtual ~ComponentBase(); virtual ~ComponentBase();
ComponentBase() = default; ComponentBase() = default;
// A component is not copiable. // A component is not copyable/movable.
ComponentBase(const ComponentBase&) = delete; ComponentBase(const ComponentBase&) = delete;
void operator=(const ComponentBase&) = delete; ComponentBase(ComponentBase&&) = delete;
ComponentBase& operator=(const ComponentBase&) = delete;
ComponentBase& operator=(ComponentBase&&) = delete;
// Component hierarchy: // Component hierarchy:
ComponentBase* Parent() const; ComponentBase* Parent() const;

View File

@ -10,7 +10,6 @@
#include <ftxui/dom/elements.hpp> // for Element, separator #include <ftxui/dom/elements.hpp> // for Element, separator
#include <ftxui/util/ref.hpp> // for Ref, ConstRef, StringRef #include <ftxui/util/ref.hpp> // for Ref, ConstRef, StringRef
#include <functional> // for function #include <functional> // for function
#include <optional> // for optional
#include <string> // for string #include <string> // for string
#include "ftxui/component/component_base.hpp" // for Component #include "ftxui/component/component_base.hpp" // for Component

View File

@ -5,9 +5,7 @@
#define FTXUI_COMPONENT_EVENT_HPP #define FTXUI_COMPONENT_EVENT_HPP
#include <ftxui/component/mouse.hpp> // for Mouse #include <ftxui/component/mouse.hpp> // for Mouse
#include <functional> #include <string> // for string, operator==
#include <string> // for string, operator==
#include <vector>
namespace ftxui { namespace ftxui {

View File

@ -24,11 +24,14 @@ class Loop {
void RunOnceBlocking(); void RunOnceBlocking();
void Run(); void Run();
private: // This class is non copyable/movable.
// This class is non copyable. Loop(const Loop&) = default;
Loop(Loop&&) = delete;
Loop& operator=(Loop&&) = delete;
Loop(const ScreenInteractive&) = delete; Loop(const ScreenInteractive&) = delete;
Loop& operator=(const Loop&) = delete; Loop& operator=(const Loop&) = delete;
private:
ScreenInteractive* screen_; ScreenInteractive* screen_;
Component component_; Component component_;
}; };

View File

@ -7,12 +7,10 @@
#include <algorithm> // for copy, max #include <algorithm> // for copy, max
#include <atomic> // for atomic, __atomic_base #include <atomic> // for atomic, __atomic_base
#include <condition_variable> // for condition_variable #include <condition_variable> // for condition_variable
#include <functional> #include <memory> // for unique_ptr, make_unique
#include <iostream> #include <mutex> // for mutex, unique_lock
#include <memory> // for unique_ptr, make_unique #include <queue> // for queue
#include <mutex> // for mutex, unique_lock #include <utility> // for move
#include <queue> // for queue
#include <utility> // for move
namespace ftxui { namespace ftxui {
@ -54,6 +52,10 @@ template<class T> Receiver<T> MakeReceiver();
template <class T> template <class T>
class SenderImpl { class SenderImpl {
public: public:
SenderImpl(const SenderImpl&) = delete;
SenderImpl(SenderImpl&&) = delete;
SenderImpl& operator=(const SenderImpl&) = delete;
SenderImpl& operator=(SenderImpl&&) = delete;
void Send(T t) { receiver_->Receive(std::move(t)); } void Send(T t) { receiver_->Receive(std::move(t)); }
~SenderImpl() { receiver_->ReleaseSender(); } ~SenderImpl() { receiver_->ReleaseSender(); }
@ -61,7 +63,7 @@ class SenderImpl {
private: private:
friend class ReceiverImpl<T>; friend class ReceiverImpl<T>;
SenderImpl(ReceiverImpl<T>* consumer) : receiver_(consumer) {} explicit SenderImpl(ReceiverImpl<T>* consumer) : receiver_(consumer) {}
ReceiverImpl<T>* receiver_; ReceiverImpl<T>* receiver_;
}; };
@ -73,15 +75,17 @@ class ReceiverImpl {
senders_++; senders_++;
return std::unique_ptr<SenderImpl<T>>(new SenderImpl<T>(this)); return std::unique_ptr<SenderImpl<T>>(new SenderImpl<T>(this));
} }
ReceiverImpl() { senders_ = 0; } ReceiverImpl() = default;
bool Receive(T* t) { bool Receive(T* t) {
while (senders_ || !queue_.empty()) { while (senders_ || !queue_.empty()) {
std::unique_lock<std::mutex> lock(mutex_); std::unique_lock<std::mutex> lock(mutex_);
if (queue_.empty()) if (queue_.empty()) {
notifier_.wait(lock); notifier_.wait(lock);
if (queue_.empty()) }
if (queue_.empty()) {
continue; continue;
}
*t = std::move(queue_.front()); *t = std::move(queue_.front());
queue_.pop(); queue_.pop();
return true; return true;
@ -91,8 +95,9 @@ class ReceiverImpl {
bool ReceiveNonBlocking(T* t) { bool ReceiveNonBlocking(T* t) {
std::unique_lock<std::mutex> lock(mutex_); std::unique_lock<std::mutex> lock(mutex_);
if (queue_.empty()) if (queue_.empty()) {
return false; return false;
}
*t = queue_.front(); *t = queue_.front();
queue_.pop(); queue_.pop();
return true; return true;
@ -127,7 +132,7 @@ class ReceiverImpl {
std::mutex mutex_; std::mutex mutex_;
std::queue<T> queue_; std::queue<T> queue_;
std::condition_variable notifier_; std::condition_variable notifier_;
std::atomic<int> senders_; std::atomic<int> senders_{0};
}; };
template <class T> template <class T>

View File

@ -4,7 +4,8 @@
#ifndef FTXUI_DOM_DEPRECATED_HPP #ifndef FTXUI_DOM_DEPRECATED_HPP
#define FTXUI_DOM_DEPRECATED_HPP #define FTXUI_DOM_DEPRECATED_HPP
#include "ftxui/dom/elements.hpp" #include <ftxui/dom/node.hpp>
#include <string>
namespace ftxui { namespace ftxui {
Element text(std::wstring text); Element text(std::wstring text);

View File

@ -14,7 +14,6 @@
#include "ftxui/dom/node.hpp" #include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp" #include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp" #include "ftxui/screen/color.hpp"
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/terminal.hpp" #include "ftxui/screen/terminal.hpp"
#include "ftxui/util/ref.hpp" #include "ftxui/util/ref.hpp"
@ -80,9 +79,7 @@ Decorator borderStyled(BorderStyle);
Decorator borderStyled(BorderStyle, Color); Decorator borderStyled(BorderStyle, Color);
Decorator borderStyled(Color); Decorator borderStyled(Color);
Decorator borderWith(const Pixel&); Decorator borderWith(const Pixel&);
Element window(Element title, Element window(Element title, Element content, BorderStyle border = ROUNDED);
Element content,
BorderStyle border = ROUNDED);
Element spinner(int charset_index, size_t image_index); Element spinner(int charset_index, size_t image_index);
Element paragraph(const std::string& text); Element paragraph(const std::string& text);
Element paragraphAlignLeft(const std::string& text); Element paragraphAlignLeft(const std::string& text);

View File

@ -22,7 +22,7 @@ using Elements = std::vector<Element>;
class Node { class Node {
public: public:
Node(); Node();
Node(Elements children); explicit Node(Elements children);
Node(const Node&) = delete; Node(const Node&) = delete;
Node(const Node&&) = delete; Node(const Node&&) = delete;
Node& operator=(const Node&) = delete; Node& operator=(const Node&) = delete;

View File

@ -4,7 +4,6 @@
#ifndef FTXUI_DOM_TABLE #ifndef FTXUI_DOM_TABLE
#define FTXUI_DOM_TABLE #define FTXUI_DOM_TABLE
#include <memory>
#include <string> // for string #include <string> // for string
#include <vector> // for vector #include <vector> // for vector
@ -37,8 +36,8 @@ class TableSelection;
class Table { class Table {
public: public:
Table(); Table();
Table(std::vector<std::vector<std::string>>); explicit Table(std::vector<std::vector<std::string>>);
Table(std::vector<std::vector<Element>>); explicit Table(std::vector<std::vector<Element>>);
TableSelection SelectAll(); TableSelection SelectAll();
TableSelection SelectCell(int column, int row); TableSelection SelectCell(int column, int row);
TableSelection SelectRow(int row_index); TableSelection SelectRow(int row_index);

View File

@ -5,7 +5,7 @@
#define FTXUI_DOM_TAKE_ANY_ARGS_HPP #define FTXUI_DOM_TAKE_ANY_ARGS_HPP
// IWYU pragma: private, include "ftxui/dom/elements.hpp" // IWYU pragma: private, include "ftxui/dom/elements.hpp"
#include <type_traits> #include <ftxui/dom/node.hpp>
namespace ftxui { namespace ftxui {
@ -19,8 +19,9 @@ inline void Merge(Elements& container, Element element) {
template <> template <>
inline void Merge(Elements& container, Elements elements) { inline void Merge(Elements& container, Elements elements) {
for (auto& element : elements) for (auto& element : elements) {
container.push_back(std::move(element)); container.push_back(std::move(element));
}
} }
// Turn a set of arguments into a vector. // Turn a set of arguments into a vector.

View File

@ -6,7 +6,6 @@
#include <cstdint> // for uint8_t #include <cstdint> // for uint8_t
#include <string> // for string #include <string> // for string
#include <vector> // for vector
#ifdef RGB #ifdef RGB
// Workaround for wingdi.h (via Windows.h) defining macros that break things. // Workaround for wingdi.h (via Windows.h) defining macros that break things.
@ -24,10 +23,12 @@ class Color {
enum Palette16 : uint8_t; enum Palette16 : uint8_t;
enum Palette256 : uint8_t; enum Palette256 : uint8_t;
// NOLINTBEGIN
Color(); // Transparent. Color(); // Transparent.
Color(Palette1 index); // Transparent. Color(Palette1 index); // Transparent.
Color(Palette16 index); // Implicit conversion from index to Color. Color(Palette16 index); // Implicit conversion from index to Color.
Color(Palette256 index); // Implicit conversion from index to Color. Color(Palette256 index); // Implicit conversion from index to Color.
// NOLINTEND
Color(uint8_t red, uint8_t green, uint8_t blue); Color(uint8_t red, uint8_t green, uint8_t blue);
static Color RGB(uint8_t red, uint8_t green, uint8_t blue); static Color RGB(uint8_t red, uint8_t green, uint8_t blue);
static Color HSV(uint8_t hue, uint8_t saturation, uint8_t value); static Color HSV(uint8_t hue, uint8_t saturation, uint8_t value);

View File

@ -4,8 +4,6 @@
#ifndef FTXUI_SCREEN_IMAGE_HPP #ifndef FTXUI_SCREEN_IMAGE_HPP
#define FTXUI_SCREEN_IMAGE_HPP #define FTXUI_SCREEN_IMAGE_HPP
#include <cstdint> // for uint8_t
#include <memory>
#include <string> // for string, basic_string, allocator #include <string> // for string, basic_string, allocator
#include <vector> // for vector #include <vector> // for vector

View File

@ -5,11 +5,9 @@
#define FTXUI_SCREEN_SCREEN_HPP #define FTXUI_SCREEN_SCREEN_HPP
#include <cstdint> // for uint8_t #include <cstdint> // for uint8_t
#include <memory> #include <string> // for string, basic_string, allocator
#include <string> // for string, basic_string, allocator #include <vector> // for vector
#include <vector> // for vector
#include "ftxui/screen/color.hpp" // for Color, Color::Default
#include "ftxui/screen/image.hpp" // for Pixel, Image #include "ftxui/screen/image.hpp" // for Pixel, Image
#include "ftxui/screen/terminal.hpp" // for Dimensions #include "ftxui/screen/terminal.hpp" // for Dimensions

View File

@ -4,10 +4,8 @@
#ifndef FTXUI_SCREEN_STRING_HPP #ifndef FTXUI_SCREEN_STRING_HPP
#define FTXUI_SCREEN_STRING_HPP #define FTXUI_SCREEN_STRING_HPP
#include <stddef.h> // for size_t #include <string> // for string, wstring, to_string
#include <cstdint> // for uint8_t #include <vector> // for vector
#include <string> // for string, wstring, to_string
#include <vector> // for vector
namespace ftxui { namespace ftxui {
std::string to_string(const std::wstring& s); std::string to_string(const std::wstring& s);
@ -30,6 +28,4 @@ std::vector<int> CellToGlyphIndex(const std::string& input);
} // namespace ftxui } // namespace ftxui
#include "ftxui/screen/deprecated.hpp"
#endif /* end of include guard: FTXUI_SCREEN_STRING_HPP */ #endif /* end of include guard: FTXUI_SCREEN_STRING_HPP */

View File

@ -16,6 +16,10 @@ class AutoReset {
: variable_(variable), previous_value_(std::move(*variable)) { : variable_(variable), previous_value_(std::move(*variable)) {
*variable_ = std::move(new_value); *variable_ = std::move(new_value);
} }
AutoReset(const AutoReset&) = delete;
AutoReset(AutoReset&&) = delete;
AutoReset& operator=(const AutoReset&) = delete;
AutoReset& operator=(AutoReset&&) = delete;
~AutoReset() { *variable_ = std::move(previous_value_); } ~AutoReset() { *variable_ = std::move(previous_value_); }
private: private:

View File

@ -15,10 +15,12 @@ template <typename T>
class ConstRef { class ConstRef {
public: public:
ConstRef() = default; ConstRef() = default;
ConstRef(T t) : variant_(std::move(t)) {} // NOLINT
ConstRef(const T* t) : variant_(t) {} // NOLINT
ConstRef& operator=(ConstRef&&) noexcept = default;
ConstRef(const ConstRef<T>&) = default; ConstRef(const ConstRef<T>&) = default;
ConstRef(ConstRef<T>&&) = default; ConstRef(ConstRef<T>&&) noexcept = default;
ConstRef(T t) : variant_(std::move(t)) {} ~ConstRef() = default;
ConstRef(const T* t) : variant_(t) {}
// Make a "reseatable" reference // Make a "reseatable" reference
ConstRef<T>& operator=(const ConstRef<T>&) = default; ConstRef<T>& operator=(const ConstRef<T>&) = default;
@ -42,10 +44,12 @@ template <typename T>
class Ref { class Ref {
public: public:
Ref() = default; Ref() = default;
Ref(T t) : variant_(std::move(t)) {} // NOLINT
Ref(T* t) : variant_(t) {} // NOLINT
~Ref() = default;
Ref& operator=(Ref&&) noexcept = default;
Ref(const Ref<T>&) = default; Ref(const Ref<T>&) = default;
Ref(Ref<T>&&) = default; Ref(Ref<T>&&) noexcept = default;
Ref(T t) : variant_(std::move(t)) {}
Ref(T* t) : variant_(t) {}
// Make a "reseatable" reference. // Make a "reseatable" reference.
Ref<T>& operator=(const Ref<T>&) = default; Ref<T>& operator=(const Ref<T>&) = default;
@ -77,8 +81,10 @@ class StringRef : public Ref<std::string> {
public: public:
using Ref<std::string>::Ref; using Ref<std::string>::Ref;
StringRef(const wchar_t* ref) : StringRef(to_string(std::wstring(ref))) {} StringRef(const wchar_t* ref) // NOLINT
StringRef(const char* ref) : StringRef(std::string(ref)) {} : StringRef(to_string(std::wstring(ref))) {}
StringRef(const char* ref) // NOLINT
: StringRef(std::string(ref)) {}
}; };
/// @brief An adapter. Own or reference a constant string. For convenience, this /// @brief An adapter. Own or reference a constant string. For convenience, this
@ -87,19 +93,27 @@ class ConstStringRef : public ConstRef<std::string> {
public: public:
using ConstRef<std::string>::ConstRef; using ConstRef<std::string>::ConstRef;
ConstStringRef(const std::wstring* ref) : ConstStringRef(to_string(*ref)) {} ConstStringRef(const std::wstring* ref) // NOLINT
ConstStringRef(const std::wstring ref) : ConstStringRef(to_string(ref)) {} : ConstStringRef(to_string(*ref)) {}
ConstStringRef(const wchar_t* ref) ConstStringRef(const std::wstring ref) // NOLINT
: ConstStringRef(to_string(ref)) {}
ConstStringRef(const wchar_t* ref) // NOLINT
: ConstStringRef(to_string(std::wstring(ref))) {} : ConstStringRef(to_string(std::wstring(ref))) {}
ConstStringRef(const char* ref) : ConstStringRef(std::string(ref)) {} ConstStringRef(const char* ref) // NOLINT
: ConstStringRef(std::string(ref)) {}
}; };
/// @brief An adapter. Reference a list of strings. /// @brief An adapter. Reference a list of strings.
class ConstStringListRef { class ConstStringListRef {
public: public:
ConstStringListRef() = default; ConstStringListRef() = default;
ConstStringListRef(const std::vector<std::string>* ref) : ref_(ref) {} ~ConstStringListRef() = default;
ConstStringListRef(const std::vector<std::wstring>* ref) : ref_wide_(ref) {} ConstStringListRef(ConstStringListRef&&) = delete;
ConstStringListRef& operator=(ConstStringListRef&&) = delete;
ConstStringListRef(const std::vector<std::string>* ref) // NOLINT
: ref_(ref) {}
ConstStringListRef(const std::vector<std::wstring>* ref) // NOLINT
: ref_wide_(ref) {}
ConstStringListRef(const ConstStringListRef& other) = default; ConstStringListRef(const ConstStringListRef& other) = default;
ConstStringListRef& operator=(const ConstStringListRef& other) = default; ConstStringListRef& operator=(const ConstStringListRef& other) = default;

View File

@ -1,5 +1,4 @@
#include <cmath> // for sin, pow, sqrt, cos #include <cmath> // for sin, pow, sqrt, cos
#include <ratio> // for ratio
#include <utility> // for move #include <utility> // for move
#include "ftxui/component/animation.hpp" #include "ftxui/component/animation.hpp"

View File

@ -3,12 +3,10 @@
// the LICENSE file. // the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <memory> // for shared_ptr
#include <utility> // for move #include <utility> // for move
#include "ftxui/component/animation.hpp" // for Animator, Params (ptr only) #include "ftxui/component/animation.hpp" // for Animator, Params (ptr only)
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse #include "ftxui/component/component.hpp" // for Make, Button
#include "ftxui/component/component.hpp" // for Make, Button
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component_options.hpp" // for ButtonOption, AnimatedColorOption, AnimatedColorsOption, EntryState #include "ftxui/component/component_options.hpp" // for ButtonOption, AnimatedColorOption, AnimatedColorsOption, EntryState
#include "ftxui/component/event.hpp" // for Event, Event::Return #include "ftxui/component/event.hpp" // for Event, Event::Return

View File

@ -1,8 +1,6 @@
// Copyright 2022 Arthur Sonzogni. All rights reserved. // Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <chrono> // for operator""s, chrono_literals
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string #include <string> // for string
#include "ftxui/component/animation.hpp" // for Duration, Params #include "ftxui/component/animation.hpp" // for Duration, Params

View File

@ -2,9 +2,7 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <memory> // for __shared_ptr_access, __shared_ptr_access<>::element_type, shared_ptr #include <utility> // for move
#include <type_traits> // for remove_reference, remove_reference<>::type
#include <utility> // for move
#include "ftxui/component/component.hpp" // for Make, CatchEvent, ComponentDecorator #include "ftxui/component/component.hpp" // for Make, CatchEvent, ComponentDecorator
#include "ftxui/component/component_base.hpp" // for Component, ComponentBase #include "ftxui/component/component_base.hpp" // for Component, ComponentBase

View File

@ -4,7 +4,6 @@
#include <functional> // for function #include <functional> // for function
#include <utility> // for move #include <utility> // for move
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/component.hpp" // for Make, Checkbox #include "ftxui/component/component.hpp" // for Make, Checkbox
#include "ftxui/component/component_base.hpp" // for Component, ComponentBase #include "ftxui/component/component_base.hpp" // for Component, ComponentBase
#include "ftxui/component/component_options.hpp" // for CheckboxOption, EntryState #include "ftxui/component/component_options.hpp" // for CheckboxOption, EntryState
@ -137,7 +136,7 @@ Component Checkbox(CheckboxOption option) {
/// ``` /// ```
// NOLINTNEXTLINE // NOLINTNEXTLINE
Component Checkbox(ConstStringRef label, bool* checked, CheckboxOption option) { Component Checkbox(ConstStringRef label, bool* checked, CheckboxOption option) {
option.label = label; option.label = std::move(label);
option.checked = checked; option.checked = checked;
return Make<CheckboxBase>(std::move(option)); return Make<CheckboxBase>(std::move(option));
} }

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <memory> // for shared_ptr, allocator
#include <utility> // for move #include <utility> // for move
#include "ftxui/component/component.hpp" // for Checkbox, Maybe, Make, Vertical, Collapsible #include "ftxui/component/component.hpp" // for Checkbox, Maybe, Make, Vertical, Collapsible

View File

@ -1,4 +1,3 @@
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string #include <string> // for string
#include "ftxui/component/component.hpp" // for Collapsible, Renderer #include "ftxui/component/component.hpp" // for Collapsible, Renderer

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <cassert> #include <cassert>
#include <iostream>
#include <vector> #include <vector>
#include "ftxui/component/component.hpp" #include "ftxui/component/component.hpp"
#include "ftxui/component/terminal_input_parser.hpp" #include "ftxui/component/terminal_input_parser.hpp"
@ -11,8 +10,9 @@ using namespace ftxui;
namespace { namespace {
bool GeneratorBool(const char*& data, size_t& size) { bool GeneratorBool(const char*& data, size_t& size) {
if (size == 0) if (size == 0) {
return false; return false;
}
auto out = bool(data[0] % 2); auto out = bool(data[0] % 2);
data++; data++;

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <memory> // for shared_ptr, __shared_ptr_access, allocator, __shared_ptr_access<>::element_type, make_shared #include <memory> // for shared_ptr, __shared_ptr_access, allocator, __shared_ptr_access<>::element_type, make_shared
#include <string> // for string
#include "ftxui/component/component.hpp" // for Make #include "ftxui/component/component.hpp" // for Make
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for ComponentBase, Component

View File

@ -5,7 +5,6 @@
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <memory> // for make_shared, __shared_ptr_access, allocator, shared_ptr, allocator_traits<>::value_type #include <memory> // for make_shared, __shared_ptr_access, allocator, shared_ptr, allocator_traits<>::value_type
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector, __alloc_traits<>::value_type
#include "ftxui/component/component.hpp" // for Horizontal, Vertical, Tab #include "ftxui/component/component.hpp" // for Horizontal, Vertical, Tab
#include "ftxui/component/component_base.hpp" // for Components, Component, ComponentBase #include "ftxui/component/component_base.hpp" // for Components, Component, ComponentBase

View File

@ -1,8 +1,6 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved. // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string
#include "ftxui/component/component.hpp" // for Horizontal, Vertical, Button, Tab #include "ftxui/component/component.hpp" // for Horizontal, Vertical, Button, Tab
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for ComponentBase, Component

View File

@ -1,9 +1,9 @@
// Copyright 2021 Arthur Sonzogni. All rights reserved. // Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <ftxui/component/event.hpp>
#include <functional> // for function #include <functional> // for function
#include <memory> // for __shared_ptr_access, allocator, shared_ptr
#include <string> // for string #include <string> // for string
#include "ftxui/component/component.hpp" // for Maybe, Checkbox, Make, Radiobox, Vertical, Dropdown #include "ftxui/component/component.hpp" // for Maybe, Checkbox, Make, Radiobox, Vertical, Dropdown
@ -96,14 +96,14 @@ Component Dropdown(DropdownOption option) {
if (is_open) { if (is_open) {
const int max_height = 12; const int max_height = 12;
return vbox({ return vbox({
checkbox_element, std::move(checkbox_element),
separator(), separator(),
radiobox_element | vscroll_indicator | frame | std::move(radiobox_element) | vscroll_indicator | frame |
size(HEIGHT, LESS_THAN, max_height), size(HEIGHT, LESS_THAN, max_height),
}) | }) |
border; border;
} }
return vbox({checkbox_element, filler()}) | border; return vbox({std::move(checkbox_element), filler()}) | border;
}; };
} }
} }

View File

@ -2,8 +2,7 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <ftxui/dom/elements.hpp> // for Element, text #include <ftxui/dom/elements.hpp> // for Element, text
#include <memory> // for shared_ptr, __shared_ptr_access, allocator #include <string> // for string
#include <string> // for string
#include "ftxui/component/component.hpp" // for Hoverable, Horizontal, operator|=, Renderer #include "ftxui/component/component.hpp" // for Hoverable, Horizontal, operator|=, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for ComponentBase, Component

View File

@ -1,7 +1,6 @@
// Copyright 2023 Arthur Sonzogni. All rights reserved. // Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string #include <string> // for string
#include "ftxui/component/component.hpp" // for Input #include "ftxui/component/component.hpp" // for Input

View File

@ -15,8 +15,8 @@ namespace ftxui {
/// @see Component, ScreenInteractive. /// @see Component, ScreenInteractive.
/// @see ScreenInteractive::Loop(). /// @see ScreenInteractive::Loop().
/// @see ScreenInteractive::ExitLoop(). /// @see ScreenInteractive::ExitLoop().
/// @param screen The screen to use. /// @param[in] screen The screen to use.
/// @param component The component to run. /// @param[in] component The component to run.
// NOLINTNEXTLINE // NOLINTNEXTLINE
Loop::Loop(ScreenInteractive* screen, Component component) Loop::Loop(ScreenInteractive* screen, Component component)
: screen_(screen), component_(std::move(component)) { : screen_(screen), component_(std::move(component)) {

View File

@ -3,8 +3,7 @@
// the LICENSE file. // the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <memory> // for make_unique, __shared_ptr_access, __shared_ptr_access<>::element_type, shared_ptr #include <memory> // for make_unique, __shared_ptr_access, __shared_ptr_access<>::element_type, shared_ptr
#include <type_traits> // for remove_reference, remove_reference<>::type #include <utility> // for move
#include <utility> // for move
#include "ftxui/component/component.hpp" // for ComponentDecorator, Maybe, Make #include "ftxui/component/component.hpp" // for ComponentDecorator, Maybe, Make
#include "ftxui/component/component_base.hpp" // for Component, ComponentBase #include "ftxui/component/component_base.hpp" // for Component, ComponentBase

View File

@ -5,13 +5,11 @@
#include <chrono> // for milliseconds #include <chrono> // for milliseconds
#include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up #include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up
#include <functional> // for function #include <functional> // for function
#include <memory> // for allocator_traits<>::value_type, swap
#include <string> // for operator+, string #include <string> // for operator+, string
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector, __alloc_traits<>::value_type #include <vector> // for vector, __alloc_traits<>::value_type
#include "ftxui/component/animation.hpp" // for Animator, Linear #include "ftxui/component/animation.hpp" // for Animator, Linear
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/component.hpp" // for Make, Menu, MenuEntry, Toggle #include "ftxui/component/component.hpp" // for Make, Menu, MenuEntry, Toggle
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component_options.hpp" // for MenuOption, MenuEntryOption, UnderlineOption, AnimatedColorOption, AnimatedColorsOption, EntryState #include "ftxui/component/component_options.hpp" // for MenuOption, MenuEntryOption, UnderlineOption, AnimatedColorOption, AnimatedColorsOption, EntryState
@ -70,7 +68,7 @@ bool IsHorizontal(Direction direction) {
/// @ingroup component /// @ingroup component
class MenuBase : public ComponentBase, public MenuOption { class MenuBase : public ComponentBase, public MenuOption {
public: public:
explicit MenuBase(MenuOption option) : MenuOption(std::move(option)) {} explicit MenuBase(const MenuOption& option) : MenuOption(option) {}
bool IsHorizontal() { return ftxui::IsHorizontal(direction); } bool IsHorizontal() { return ftxui::IsHorizontal(direction); }
void OnChange() { void OnChange() {
@ -547,7 +545,7 @@ Component Menu(MenuOption option) {
Component Menu(ConstStringListRef entries, int* selected, MenuOption option) { Component Menu(ConstStringListRef entries, int* selected, MenuOption option) {
option.entries = entries; option.entries = entries;
option.selected = selected; option.selected = selected;
return Menu(std::move(option)); return Menu(option);
} }
/// @brief An horizontal list of elements. The user can navigate through them. /// @brief An horizontal list of elements. The user can navigate through them.
@ -586,7 +584,7 @@ Component Toggle(ConstStringListRef entries, int* selected) {
/// entry 3 /// entry 3
/// ``` /// ```
Component MenuEntry(ConstStringRef label, MenuEntryOption option) { Component MenuEntry(ConstStringRef label, MenuEntryOption option) {
option.label = label; option.label = std::move(label);
return MenuEntry(std::move(option)); return MenuEntry(std::move(option));
} }

View File

@ -2,11 +2,9 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <gtest/gtest.h> // for Test, EXPECT_EQ, Message, TestPartResult, TestInfo (ptr only), TEST #include <gtest/gtest.h> // for Test, EXPECT_EQ, Message, TestPartResult, TestInfo (ptr only), TEST
#include <chrono> // for operator""s, chrono_literals
#include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up #include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up
#include <memory> // for __shared_ptr_access, shared_ptr, allocator #include <string> // for string, basic_string
#include <string> // for string, basic_string #include <vector> // for vector
#include <vector> // for vector
#include "ftxui/component/animation.hpp" // for Duration, Params #include "ftxui/component/animation.hpp" // for Duration, Params
#include "ftxui/component/component.hpp" // for Menu #include "ftxui/component/component.hpp" // for Menu

View File

@ -3,7 +3,6 @@
// the LICENSE file. // the LICENSE file.
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <ftxui/dom/elements.hpp> // for Element, operator|, text, border #include <ftxui/dom/elements.hpp> // for Element, operator|, text, border
#include <memory> // for shared_ptr, allocator, __shared_ptr_access
#include "ftxui/component/component.hpp" // for Renderer, Modal #include "ftxui/component/component.hpp" // for Renderer, Modal
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase

View File

@ -2,11 +2,9 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <memory> // for allocator_traits<>::value_type
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/component.hpp" // for Make, Radiobox #include "ftxui/component/component.hpp" // for Make, Radiobox
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component_options.hpp" // for RadioboxOption, EntryState #include "ftxui/component/component_options.hpp" // for RadioboxOption, EntryState
@ -26,7 +24,8 @@ namespace {
/// @ingroup component /// @ingroup component
class RadioboxBase : public ComponentBase, public RadioboxOption { class RadioboxBase : public ComponentBase, public RadioboxOption {
public: public:
explicit RadioboxBase(RadioboxOption option) : RadioboxOption(option) {} explicit RadioboxBase(const RadioboxOption& option)
: RadioboxOption(option) {}
private: private:
Element Render() override { Element Render() override {

View File

@ -4,9 +4,8 @@
#include <ftxui/dom/elements.hpp> // for yframe #include <ftxui/dom/elements.hpp> // for yframe
#include <ftxui/dom/node.hpp> // for Render #include <ftxui/dom/node.hpp> // for Render
#include <ftxui/screen/screen.hpp> // for Screen #include <ftxui/screen/screen.hpp> // for Screen
#include <memory> // for __shared_ptr_access, shared_ptr, allocator #include <string> // for string, basic_string
#include <string> // for string, basic_string #include <vector> // for vector
#include <vector> // for vector
#include "ftxui/component/component.hpp" // for Radiobox, operator| #include "ftxui/component/component.hpp" // for Radiobox, operator|
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for ComponentBase, Component

View File

@ -1,7 +1,6 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved. // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <string> // for string
#include <thread> // for thread #include <thread> // for thread
#include <utility> // for move #include <utility> // for move

View File

@ -2,10 +2,8 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <memory> // for __shared_ptr_access, shared_ptr
#include <utility> // for move #include <utility> // for move
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/component.hpp" // for Make, Renderer #include "ftxui/component/component.hpp" // for Make, Renderer
#include "ftxui/component/component_base.hpp" // for Component, ComponentBase #include "ftxui/component/component_base.hpp" // for Component, ComponentBase
#include "ftxui/component/event.hpp" // for Event #include "ftxui/component/event.hpp" // for Event

View File

@ -5,8 +5,7 @@
#include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up #include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up
#include <ftxui/util/ref.hpp> // for Ref #include <ftxui/util/ref.hpp> // for Ref
#include <functional> // for function #include <functional> // for function
#include <memory> // for __shared_ptr_access, shared_ptr, allocator #include <utility> // for move
#include <utility> // for move
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse #include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/component.hpp" // for Horizontal, Make, ResizableSplit, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop #include "ftxui/component/component.hpp" // for Horizontal, Make, ResizableSplit, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop

View File

@ -2,8 +2,7 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up #include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up
#include <memory> // for __shared_ptr_access, shared_ptr, allocator #include <string> // for string
#include <string> // for string
#include "ftxui/component/component.hpp" // for ResizableSplit, Renderer, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop #include "ftxui/component/component.hpp" // for ResizableSplit, Renderer, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for ComponentBase, Component

View File

@ -248,7 +248,7 @@ void ExecuteSignalHandlers() {
void InstallSignalHandler(int sig) { void InstallSignalHandler(int sig) {
auto old_signal_handler = std::signal(sig, RecordSignal); auto old_signal_handler = std::signal(sig, RecordSignal);
on_exit_functions.push( on_exit_functions.emplace(
[=] { std::ignore = std::signal(sig, old_signal_handler); }); [=] { std::ignore = std::signal(sig, old_signal_handler); });
} }
@ -590,14 +590,14 @@ void ScreenInteractive::Install() {
// After uninstalling the new configuration, flush it to the terminal to // After uninstalling the new configuration, flush it to the terminal to
// ensure it is fully applied: // ensure it is fully applied:
on_exit_functions.push([] { Flush(); }); on_exit_functions.emplace([] { Flush(); });
on_exit_functions.push([this] { ExitLoopClosure()(); }); on_exit_functions.emplace([this] { ExitLoopClosure()(); });
// Request the terminal to report the current cursor shape. We will restore it // Request the terminal to report the current cursor shape. We will restore it
// on exit. // on exit.
std::cout << DECRQSS_DECSCUSR; std::cout << DECRQSS_DECSCUSR;
on_exit_functions.push([=] { on_exit_functions.emplace([=] {
std::cout << "\033[?25h"; // Enable cursor. std::cout << "\033[?25h"; // Enable cursor.
std::cout << "\033[" + std::to_string(cursor_reset_shape_) + " q"; std::cout << "\033[" + std::to_string(cursor_reset_shape_) + " q";
}); });
@ -646,7 +646,8 @@ void ScreenInteractive::Install() {
struct termios terminal; // NOLINT struct termios terminal; // NOLINT
tcgetattr(STDIN_FILENO, &terminal); tcgetattr(STDIN_FILENO, &terminal);
on_exit_functions.push([=] { tcsetattr(STDIN_FILENO, TCSANOW, &terminal); }); on_exit_functions.emplace(
[=] { tcsetattr(STDIN_FILENO, TCSANOW, &terminal); });
// Enabling raw terminal input mode // Enabling raw terminal input mode
terminal.c_iflag &= ~IGNBRK; // Disable ignoring break condition terminal.c_iflag &= ~IGNBRK; // Disable ignoring break condition
@ -680,12 +681,12 @@ void ScreenInteractive::Install() {
auto enable = [&](const std::vector<DECMode>& parameters) { auto enable = [&](const std::vector<DECMode>& parameters) {
std::cout << Set(parameters); std::cout << Set(parameters);
on_exit_functions.push([=] { std::cout << Reset(parameters); }); on_exit_functions.emplace([=] { std::cout << Reset(parameters); });
}; };
auto disable = [&](const std::vector<DECMode>& parameters) { auto disable = [&](const std::vector<DECMode>& parameters) {
std::cout << Reset(parameters); std::cout << Reset(parameters);
on_exit_functions.push([=] { std::cout << Set(parameters); }); on_exit_functions.emplace([=] { std::cout << Set(parameters); });
}; };
if (use_alternative_screen_) { if (use_alternative_screen_) {

View File

@ -1,8 +1,7 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved. // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <algorithm> // for max, min #include <algorithm> // for max, min
#include <cstdint> // for uint8_t, uint16_t, uint32_t, uint64_t
#include <ftxui/component/component_options.hpp> // for SliderOption #include <ftxui/component/component_options.hpp> // for SliderOption
#include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up #include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up
#include <string> // for allocator #include <string> // for allocator

View File

@ -6,8 +6,7 @@
#include <ftxui/component/mouse.hpp> // for Mouse, Mouse::Left, Mouse::Pressed, Mouse::Released #include <ftxui/component/mouse.hpp> // for Mouse, Mouse::Left, Mouse::Pressed, Mouse::Released
#include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up #include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up
#include <ftxui/dom/elements.hpp> // for frame #include <ftxui/dom/elements.hpp> // for frame
#include <memory> // for shared_ptr, __shared_ptr_access, allocator #include <string> // for string, to_string
#include <string> // for string, to_string
#include "ftxui/component/component.hpp" // for Slider, Vertical, operator|= #include "ftxui/component/component.hpp" // for Slider, Vertical, operator|=
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase

View File

@ -4,11 +4,9 @@
#ifndef FTXUI_COMPONENT_TERMINAL_INPUT_PARSER #ifndef FTXUI_COMPONENT_TERMINAL_INPUT_PARSER
#define FTXUI_COMPONENT_TERMINAL_INPUT_PARSER #define FTXUI_COMPONENT_TERMINAL_INPUT_PARSER
#include <memory> // for unique_ptr
#include <string> // for string #include <string> // for string
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/component/event.hpp" // for Event (ptr only)
#include "ftxui/component/mouse.hpp" // for Mouse #include "ftxui/component/mouse.hpp" // for Mouse
#include "ftxui/component/receiver.hpp" // for Sender #include "ftxui/component/receiver.hpp" // for Sender
#include "ftxui/component/task.hpp" // for Task #include "ftxui/component/task.hpp" // for Task
@ -19,7 +17,7 @@ struct Event;
// Parse a sequence of |char| accross |time|. Produces |Event|. // Parse a sequence of |char| accross |time|. Produces |Event|.
class TerminalInputParser { class TerminalInputParser {
public: public:
TerminalInputParser(Sender<Task> out); explicit TerminalInputParser(Sender<Task> out);
void Timeout(int time); void Timeout(int time);
void Add(char c); void Add(char c);
@ -46,11 +44,12 @@ class TerminalInputParser {
Type type; Type type;
union { union {
Mouse mouse; Mouse mouse;
CursorPosition cursor; CursorPosition cursor{};
int cursor_shape; int cursor_shape;
}; };
Output(Type t) : type(t) {} Output(Type t) // NOLINT
: type(t) {}
}; };
void Send(Output output); void Send(Output output);

View File

@ -5,7 +5,6 @@
#include <ftxui/component/task.hpp> // for Task #include <ftxui/component/task.hpp> // for Task
#include <initializer_list> // for initializer_list #include <initializer_list> // for initializer_list
#include <memory> // for allocator, unique_ptr #include <memory> // for allocator, unique_ptr
#include <variant> // for get
#include "ftxui/component/event.hpp" // for Event, Event::Return, Event::ArrowDown, Event::ArrowLeft, Event::ArrowRight, Event::ArrowUp, Event::Backspace, Event::End, Event::Home, Event::Custom, Event::Delete, Event::F1, Event::F10, Event::F11, Event::F12, Event::F2, Event::F3, Event::F4, Event::F5, Event::F6, Event::F7, Event::F8, Event::F9, Event::PageDown, Event::PageUp, Event::Tab, Event::TabReverse, Event::Escape #include "ftxui/component/event.hpp" // for Event, Event::Return, Event::ArrowDown, Event::ArrowLeft, Event::ArrowRight, Event::ArrowUp, Event::Backspace, Event::End, Event::Home, Event::Custom, Event::Delete, Event::F1, Event::F10, Event::F11, Event::F12, Event::F2, Event::F3, Event::F4, Event::F5, Event::F6, Event::F7, Event::F8, Event::F9, Event::PageDown, Event::PageUp, Event::Tab, Event::TabReverse, Event::Escape
#include "ftxui/component/receiver.hpp" // for MakeReceiver, ReceiverImpl #include "ftxui/component/receiver.hpp" // for MakeReceiver, ReceiverImpl

View File

@ -1,7 +1,6 @@
// Copyright 2021 Arthur Sonzogni. All rights reserved. // Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <vector>
#include "ftxui/component/terminal_input_parser.hpp" #include "ftxui/component/terminal_input_parser.hpp"
extern "C" int LLVMFuzzerTestOneInput(const char* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const char* data, size_t size) {
@ -9,12 +8,14 @@ extern "C" int LLVMFuzzerTestOneInput(const char* data, size_t size) {
auto event_receiver = MakeReceiver<Task>(); auto event_receiver = MakeReceiver<Task>();
{ {
auto parser = TerminalInputParser(event_receiver->MakeSender()); auto parser = TerminalInputParser(event_receiver->MakeSender());
for (size_t i = 0; i < size; ++i) for (size_t i = 0; i < size; ++i) {
parser.Add(data[i]); parser.Add(data[i]);
}
} }
Task received; Task received;
while (event_receiver->Receive(&received)) while (event_receiver->Receive(&received)) {
; // Do nothing.
}
return 0; // Non-zero return values are reserved for future use. return 0; // Non-zero return values are reserved for future use.
} }

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string, basic_string #include <string> // for string, basic_string
#include <vector> // for vector #include <vector> // for vector

View File

@ -6,8 +6,7 @@
#include <vector> #include <vector>
namespace ftxui { namespace ftxui::box_helper {
namespace box_helper {
struct Element { struct Element {
// Input: // Input:
@ -21,7 +20,6 @@ struct Element {
void Compute(std::vector<Element>* elements, int target_size); void Compute(std::vector<Element>* elements, int target_size);
} // namespace box_helper } // namespace ftxui::box_helper
} // namespace ftxui
#endif /* end of include guard: FTXUI_DOM_BOX_HELPER_HPP */ #endif /* end of include guard: FTXUI_DOM_BOX_HELPER_HPP */

View File

@ -341,7 +341,7 @@ void Canvas::DrawPointEllipse(int x1,
int dy = x * x; int dy = x * x;
int err = dx + dy; int err = dx + dy;
do { do { // NOLINT
DrawPoint(x1 - x, y1 + y, true, s); DrawPoint(x1 - x, y1 + y, true, s);
DrawPoint(x1 + x, y1 + y, true, s); DrawPoint(x1 + x, y1 + y, true, s);
DrawPoint(x1 + x, y1 - y, true, s); DrawPoint(x1 + x, y1 - y, true, s);
@ -405,7 +405,7 @@ void Canvas::DrawPointEllipseFilled(int x1,
int dy = x * x; int dy = x * x;
int err = dx + dy; int err = dx + dy;
do { do { // NOLINT
for (int xx = x1 + x; xx <= x1 - x; ++xx) { for (int xx = x1 + x; xx <= x1 - x; ++xx) {
DrawPoint(xx, y1 + y, true, s); DrawPoint(xx, y1 + y, true, s);
DrawPoint(xx, y1 - y, true, s); DrawPoint(xx, y1 - y, true, s);
@ -686,7 +686,7 @@ void Canvas::DrawBlockEllipse(int x1,
int dy = x * x; int dy = x * x;
int err = dx + dy; int err = dx + dy;
do { do { // NOLINT
DrawBlock(x1 - x, 2 * (y1 + y), true, s); DrawBlock(x1 - x, 2 * (y1 + y), true, s);
DrawBlock(x1 + x, 2 * (y1 + y), true, s); DrawBlock(x1 + x, 2 * (y1 + y), true, s);
DrawBlock(x1 + x, 2 * (y1 - y), true, s); DrawBlock(x1 + x, 2 * (y1 - y), true, s);
@ -752,7 +752,7 @@ void Canvas::DrawBlockEllipseFilled(int x1,
int dy = x * x; int dy = x * x;
int err = dx + dy; int err = dx + dy;
do { do { // NOLINT
for (int xx = x1 + x; xx <= x1 - x; ++xx) { for (int xx = x1 + x; xx <= x1 - x; ++xx) {
DrawBlock(xx, 2 * (y1 + y), true, s); DrawBlock(xx, 2 * (y1 + y), true, s);
DrawBlock(xx, 2 * (y1 - y), true, s); DrawBlock(xx, 2 * (y1 - y), true, s);

View File

@ -4,7 +4,6 @@
#include <algorithm> // for max #include <algorithm> // for max
#include <memory> // for __shared_ptr_access, shared_ptr, make_shared #include <memory> // for __shared_ptr_access, shared_ptr, make_shared
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for Element, Elements, dbox #include "ftxui/dom/elements.hpp" // for Element, Elements, dbox
#include "ftxui/dom/node.hpp" // for Node, Elements #include "ftxui/dom/node.hpp" // for Node, Elements

View File

@ -6,7 +6,6 @@
#include <algorithm> // for max, min #include <algorithm> // for max, min
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <ftxui/dom/flexbox_config.hpp> // for FlexboxConfig, FlexboxConfig::Direction, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::Wrap, FlexboxConfig::Direction::RowInversed, FlexboxConfig::AlignItems, FlexboxConfig::Direction::Row, FlexboxConfig::Direction::Column, FlexboxConfig::Direction::ColumnInversed, FlexboxConfig::Wrap::WrapInversed, FlexboxConfig::AlignContent::Stretch, FlexboxConfig::JustifyContent::Stretch, FlexboxConfig::Wrap::Wrap, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignContent::FlexEnd, FlexboxConfig::AlignContent::FlexStart, FlexboxConfig::AlignContent::SpaceAround, FlexboxConfig::AlignContent::SpaceBetween, FlexboxConfig::AlignContent::SpaceEvenly, FlexboxConfig::AlignItems::Center, FlexboxConfig::AlignItems::FlexEnd, FlexboxConfig::AlignItems::FlexStart, FlexboxConfig::AlignItems::Stretch, FlexboxConfig::JustifyContent::Center, FlexboxConfig::JustifyContent::FlexEnd, FlexboxConfig::JustifyContent::FlexStart, FlexboxConfig::JustifyContent::SpaceAround, FlexboxConfig::JustifyContent::SpaceBetween, FlexboxConfig::JustifyContent::SpaceEvenly, FlexboxConfig::Wrap::NoWrap #include <ftxui/dom/flexbox_config.hpp> // for FlexboxConfig, FlexboxConfig::Direction, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::Wrap, FlexboxConfig::Direction::RowInversed, FlexboxConfig::AlignItems, FlexboxConfig::Direction::Row, FlexboxConfig::Direction::Column, FlexboxConfig::Direction::ColumnInversed, FlexboxConfig::Wrap::WrapInversed, FlexboxConfig::AlignContent::Stretch, FlexboxConfig::JustifyContent::Stretch, FlexboxConfig::Wrap::Wrap, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignContent::FlexEnd, FlexboxConfig::AlignContent::FlexStart, FlexboxConfig::AlignContent::SpaceAround, FlexboxConfig::AlignContent::SpaceBetween, FlexboxConfig::AlignContent::SpaceEvenly, FlexboxConfig::AlignItems::Center, FlexboxConfig::AlignItems::FlexEnd, FlexboxConfig::AlignItems::FlexStart, FlexboxConfig::AlignItems::Stretch, FlexboxConfig::JustifyContent::Center, FlexboxConfig::JustifyContent::FlexEnd, FlexboxConfig::JustifyContent::FlexStart, FlexboxConfig::JustifyContent::SpaceAround, FlexboxConfig::JustifyContent::SpaceBetween, FlexboxConfig::JustifyContent::SpaceEvenly, FlexboxConfig::Wrap::NoWrap
#include <memory> // for allocator_traits<>::value_type
#include <utility> // for swap, move #include <utility> // for swap, move
#include "ftxui/dom/box_helper.hpp" // for Element, Compute #include "ftxui/dom/box_helper.hpp" // for Element, Compute

View File

@ -7,8 +7,7 @@
#include <vector> #include <vector>
#include "ftxui/dom/flexbox_config.hpp" #include "ftxui/dom/flexbox_config.hpp"
namespace ftxui { namespace ftxui::flexbox_helper {
namespace flexbox_helper {
struct Block { struct Block {
// Input: // Input:
@ -20,8 +19,8 @@ struct Block {
int flex_shrink_y = 0; int flex_shrink_y = 0;
// Output: // Output:
int line; int line{};
int line_position; int line_position{};
int x = 0; int x = 0;
int y = 0; int y = 0;
int dim_x = 0; int dim_x = 0;
@ -38,7 +37,6 @@ struct Global {
void Compute(Global& global); void Compute(Global& global);
} // namespace flexbox_helper } // namespace ftxui::flexbox_helper
} // namespace ftxui
#endif /* end of include guard: FTXUI_DOM_FLEXBOX_HELPER_HPP*/ #endif /* end of include guard: FTXUI_DOM_FLEXBOX_HELPER_HPP*/

View File

@ -3,7 +3,6 @@
// the LICENSE file. // the LICENSE file.
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <ftxui/dom/flexbox_config.hpp> // for FlexboxConfig, FlexboxConfig::Direction, FlexboxConfig::Direction::Column, FlexboxConfig::Direction::ColumnInversed, FlexboxConfig::Direction::Row, FlexboxConfig::Direction::RowInversed #include <ftxui/dom/flexbox_config.hpp> // for FlexboxConfig, FlexboxConfig::Direction, FlexboxConfig::Direction::Column, FlexboxConfig::Direction::ColumnInversed, FlexboxConfig::Direction::Row, FlexboxConfig::Direction::RowInversed
#include <memory> // for allocator_traits<>::value_type
#include "ftxui/dom/flexbox_helper.hpp" #include "ftxui/dom/flexbox_helper.hpp"

View File

@ -4,7 +4,6 @@
#include <algorithm> // for max, min #include <algorithm> // for max, min
#include <memory> // for make_shared, __shared_ptr_access #include <memory> // for make_shared, __shared_ptr_access
#include <utility> // for move #include <utility> // for move
#include <vector> // for __alloc_traits<>::value_type
#include "ftxui/dom/elements.hpp" // for Element, unpack, Elements, focus, frame, select, xframe, yframe #include "ftxui/dom/elements.hpp" // for Element, unpack, Elements, focus, frame, select, xframe, yframe
#include "ftxui/dom/node.hpp" // for Node, Elements #include "ftxui/dom/node.hpp" // for Node, Elements

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <memory> // for allocator
#include "ftxui/dom/elements.hpp" // for gauge, gaugeUp #include "ftxui/dom/elements.hpp" // for gauge, gaugeUp
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render

View File

@ -35,7 +35,7 @@ int Integrate(std::vector<int>& elements) {
class GridBox : public Node { class GridBox : public Node {
public: public:
explicit GridBox(std::vector<Elements> lines) : lines_(std::move(lines)) { explicit GridBox(std::vector<Elements> lines) : lines_(std::move(lines)) {
y_size = lines_.size(); y_size = static_cast<int>(lines_.size());
for (const auto& line : lines_) { for (const auto& line : lines_) {
x_size = std::max(x_size, int(line.size())); x_size = std::max(x_size, int(line.size()));
} }

View File

@ -4,7 +4,6 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <algorithm> // for remove #include <algorithm> // for remove
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <memory> // for shared_ptr
#include <string> // for allocator, basic_string, string #include <string> // for allocator, basic_string, string
#include <vector> // for vector #include <vector> // for vector

View File

@ -3,7 +3,6 @@
// the LICENSE file. // the LICENSE file.
#include <gtest/gtest.h> // for Test, EXPECT_EQ, Message, TestPartResult, TestInfo (ptr only), TEST #include <gtest/gtest.h> // for Test, EXPECT_EQ, Message, TestPartResult, TestInfo (ptr only), TEST
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient::Stop, LinearGradient #include <ftxui/dom/linear_gradient.hpp> // for LinearGradient::Stop, LinearGradient
#include <memory> // for allocator_traits<>::value_type
#include "ftxui/dom/elements.hpp" // for operator|, text, bgcolor, color, Element #include "ftxui/dom/elements.hpp" // for operator|, text, bgcolor, color, Element
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <ftxui/dom/node.hpp> // for Node, Elements #include <ftxui/dom/node.hpp> // for Node, Elements
#include <memory> // for __shared_ptr_access
#include <vector> // for __alloc_traits<>::value_type
#include "ftxui/dom/node_decorator.hpp" #include "ftxui/dom/node_decorator.hpp"
#include "ftxui/dom/requirement.hpp" // for Requirement #include "ftxui/dom/requirement.hpp" // for Requirement

View File

@ -15,7 +15,7 @@ struct Box;
// Helper class. // Helper class.
class NodeDecorator : public Node { class NodeDecorator : public Node {
public: public:
NodeDecorator(Element child) : Node(unpack(std::move(child))) {} explicit NodeDecorator(Element child) : Node(unpack(std::move(child))) {}
void ComputeRequirement() override; void ComputeRequirement() override;
void SetBox(Box box) override; void SetBox(Box box) override;
}; };

View File

@ -3,7 +3,6 @@
// the LICENSE file. // the LICENSE file.
#include <memory> // for make_shared, __shared_ptr_access #include <memory> // for make_shared, __shared_ptr_access
#include <utility> // for move #include <utility> // for move
#include <vector> // for __alloc_traits<>::value_type
#include "ftxui/dom/elements.hpp" // for Element, unpack, Decorator, reflect #include "ftxui/dom/elements.hpp" // for Element, unpack, Decorator, reflect
#include "ftxui/dom/node.hpp" // for Node, Elements #include "ftxui/dom/node.hpp" // for Node, Elements

View File

@ -5,7 +5,6 @@
#include <memory> // for make_shared, __shared_ptr_access #include <memory> // for make_shared, __shared_ptr_access
#include <string> // for string #include <string> // for string
#include <utility> // for move #include <utility> // for move
#include <vector> // for __alloc_traits<>::value_type
#include "ftxui/dom/elements.hpp" // for Element, vscroll_indicator, hscroll_indicator #include "ftxui/dom/elements.hpp" // for Element, vscroll_indicator, hscroll_indicator
#include "ftxui/dom/node.hpp" // for Node, Elements #include "ftxui/dom/node.hpp" // for Node, Elements

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <memory> // for shared_ptr
#include <string> // for allocator, to_string, string #include <string> // for allocator, to_string, string
#include <utility> // for move #include <utility> // for move

View File

@ -4,7 +4,6 @@
#include <algorithm> // for min, max #include <algorithm> // for min, max
#include <memory> // for make_shared, __shared_ptr_access #include <memory> // for make_shared, __shared_ptr_access
#include <utility> // for move #include <utility> // for move
#include <vector> // for __alloc_traits<>::value_type
#include "ftxui/dom/elements.hpp" // for Constraint, WidthOrHeight, EQUAL, GREATER_THAN, LESS_THAN, WIDTH, unpack, Decorator, Element, size #include "ftxui/dom/elements.hpp" // for Constraint, WidthOrHeight, EQUAL, GREATER_THAN, LESS_THAN, WIDTH, unpack, Decorator, Element, size
#include "ftxui/dom/node.hpp" // for Node, Elements #include "ftxui/dom/node.hpp" // for Node, Elements

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <memory> // for allocator, allocator_traits<>::value_type
#include <string> // for basic_string, string #include <string> // for basic_string, string
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector, __alloc_traits<>::value_type #include <vector> // for vector, __alloc_traits<>::value_type

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <string> // for allocator
#include "ftxui/dom/elements.hpp" // for spinner #include "ftxui/dom/elements.hpp" // for spinner
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render

View File

@ -73,7 +73,7 @@ Table::Table(std::vector<std::vector<Element>> input) {
// private // private
void Table::Initialize(std::vector<std::vector<Element>> input) { void Table::Initialize(std::vector<std::vector<Element>> input) {
input_dim_y_ = input.size(); input_dim_y_ = static_cast<int>(input.size());
input_dim_x_ = 0; input_dim_x_ = 0;
for (auto& row : input) { for (auto& row : input) {
input_dim_x_ = std::max(input_dim_x_, int(row.size())); input_dim_x_ = std::max(input_dim_x_, int(row.size()));

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <memory> // for allocator
#include "ftxui/dom/elements.hpp" // for LIGHT, flex, center, EMPTY, DOUBLE #include "ftxui/dom/elements.hpp" // for LIGHT, flex, center, EMPTY, DOUBLE
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render

View File

@ -5,7 +5,6 @@
#include <memory> // for make_shared #include <memory> // for make_shared
#include <string> // for string, wstring #include <string> // for string, wstring
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector
#include "ftxui/dom/deprecated.hpp" // for text, vtext #include "ftxui/dom/deprecated.hpp" // for text, vtext
#include "ftxui/dom/elements.hpp" // for Element, text, vtext #include "ftxui/dom/elements.hpp" // for Element, text, vtext

View File

@ -1,12 +1,10 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved. // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <algorithm> // for min #include <algorithm> // for min
#include <functional> // for function #include <functional> // for function
#include <memory> // for __shared_ptr_access, make_unique #include <memory> // for __shared_ptr_access, make_unique
#include <type_traits> // for remove_reference, remove_reference<>::type #include <utility> // for move
#include <utility> // for move
#include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for Element, Decorator, Elements, operator|, Fit, emptyElement, nothing, operator|= #include "ftxui/dom/elements.hpp" // for Element, Decorator, Elements, operator|, Fit, emptyElement, nothing, operator|=
#include "ftxui/dom/node.hpp" // for Node, Node::Status #include "ftxui/dom/node.hpp" // for Node, Node::Status

View File

@ -6,7 +6,6 @@
#include <array> // for array #include <array> // for array
#include <cmath> #include <cmath>
#include <cstdint> #include <cstdint>
#include <string_view> // for literals
#include "ftxui/screen/color_info.hpp" // for GetColorInfo, ColorInfo #include "ftxui/screen/color_info.hpp" // for GetColorInfo, ColorInfo
#include "ftxui/screen/terminal.hpp" // for ColorSupport, Color, Palette256, TrueColor #include "ftxui/screen/terminal.hpp" // for ColorSupport, Color, Palette256, TrueColor

View File

@ -1,16 +1,9 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved. // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <cstdint> // for size_t
#include <iostream> // for operator<<, stringstream, basic_ostream, flush, cout, ostream
#include <limits>
#include <map> // for _Rb_tree_const_iterator, map, operator!=, operator==
#include <memory> // for allocator, allocator_traits<>::value_type
#include <sstream> // IWYU pragma: keep #include <sstream> // IWYU pragma: keep
#include <utility> // for pair
#include "ftxui/screen/image.hpp" #include "ftxui/screen/image.hpp"
#include "ftxui/screen/string.hpp" // for string_width
namespace ftxui { namespace ftxui {

View File

@ -5,7 +5,6 @@
#include <iostream> // for operator<<, stringstream, basic_ostream, flush, cout, ostream #include <iostream> // for operator<<, stringstream, basic_ostream, flush, cout, ostream
#include <limits> #include <limits>
#include <map> // for _Rb_tree_const_iterator, map, operator!=, operator== #include <map> // for _Rb_tree_const_iterator, map, operator!=, operator==
#include <memory> // for allocator, allocator_traits<>::value_type
#include <sstream> // IWYU pragma: keep #include <sstream> // IWYU pragma: keep
#include <utility> // for pair #include <utility> // for pair

View File

@ -5,6 +5,8 @@
#define FTXUI_SCREEN_STRING_INTERNAL_HPP #define FTXUI_SCREEN_STRING_INTERNAL_HPP
#include <cstdint> #include <cstdint>
#include <string>
#include <vector>
namespace ftxui { namespace ftxui {

View File

@ -4,8 +4,7 @@
#ifndef FTXUI_SCREEN_UTIL_HPP #ifndef FTXUI_SCREEN_UTIL_HPP
#define FTXUI_SCREEN_UTIL_HPP #define FTXUI_SCREEN_UTIL_HPP
namespace ftxui { namespace ftxui::util {
namespace util {
// Similar to std::clamp, but allow hi to be lower than lo. // Similar to std::clamp, but allow hi to be lower than lo.
template <class T> template <class T>
@ -13,7 +12,6 @@ constexpr const T& clamp(const T& v, const T& lo, const T& hi) {
return v < lo ? lo : hi < v ? hi : v; return v < lo ? lo : hi < v ? hi : v;
} }
} // namespace util } // namespace ftxui::util
} // namespace ftxui
#endif /* end of include guard: FTXUI_SCREEN_UTIL_HPP */ #endif /* end of include guard: FTXUI_SCREEN_UTIL_HPP */