diff --git a/src/ftxui/component/component_options.cpp b/src/ftxui/component/component_options.cpp index e8a1cf1..83e8714 100644 --- a/src/ftxui/component/component_options.cpp +++ b/src/ftxui/component/component_options.cpp @@ -181,11 +181,13 @@ ButtonOption ButtonOption::Animated(Color color) { /// @brief Create a ButtonOption, using animated colors. // static ButtonOption ButtonOption::Animated(Color background, Color foreground) { + // NOLINTBEGIN return ButtonOption::Animated( /*bakground=*/background, /*foreground=*/foreground, /*background_active=*/foreground, /*foreground_active=*/background); + // NOLINTEND } /// @brief Create a ButtonOption, using animated colors. diff --git a/src/ftxui/component/screen_interactive.cpp b/src/ftxui/component/screen_interactive.cpp index 9248dea..899f518 100644 --- a/src/ftxui/component/screen_interactive.cpp +++ b/src/ftxui/component/screen_interactive.cpp @@ -10,6 +10,7 @@ #include // for cout, ostream, basic_ostream, operator<<, endl, flush #include // for stack #include // for thread, sleep_for +#include #include // for decay_t #include // for move, swap #include // for visit @@ -240,7 +241,8 @@ void OnExit(int signal) { const auto install_signal_handler = [](int sig, SignalHandler handler) { auto old_signal_handler = std::signal(sig, handler); - on_exit_functions.push([=] { std::signal(sig, old_signal_handler); }); + on_exit_functions.push( + [=] { std::ignore = std::signal(sig, old_signal_handler); }); }; Closure g_on_resize = [] {}; // NOLINT @@ -289,22 +291,42 @@ ScreenInteractive::ScreenInteractive(int dimx, // static ScreenInteractive ScreenInteractive::FixedSize(int dimx, int dimy) { - return ScreenInteractive(dimx, dimy, Dimension::Fixed, false); + return { + dimx, + dimy, + Dimension::Fixed, + false, + }; } // static ScreenInteractive ScreenInteractive::Fullscreen() { - return ScreenInteractive(0, 0, Dimension::Fullscreen, true); + return { + 0, + 0, + Dimension::Fullscreen, + true, + }; } // static ScreenInteractive ScreenInteractive::TerminalOutput() { - return ScreenInteractive(0, 0, Dimension::TerminalOutput, false); + return { + 0, + 0, + Dimension::TerminalOutput, + false, + }; } // static ScreenInteractive ScreenInteractive::FitComponent() { - return ScreenInteractive(0, 0, Dimension::FitComponent, false); + return { + 0, + 0, + Dimension::FitComponent, + false, + }; } void ScreenInteractive::Post(Task task) { @@ -684,7 +706,7 @@ void ScreenInteractive::SigStop() { dimx_ = 0; dimy_ = 0; Flush(); - std::raise(SIGTSTP); + std::ignore = std::raise(SIGTSTP); Install(); }); #endif diff --git a/src/ftxui/component/slider.cpp b/src/ftxui/component/slider.cpp index 6216551..2bb1a89 100644 --- a/src/ftxui/component/slider.cpp +++ b/src/ftxui/component/slider.cpp @@ -33,7 +33,7 @@ Decorator flexDirection(GaugeDirection direction) { template class SliderBase : public ComponentBase { public: - SliderBase(Ref> options) + explicit SliderBase(Ref> options) : value_(options->value), min_(options->min), max_(options->max), @@ -125,8 +125,9 @@ class SliderBase : public ComponentBase { } value_() = util::clamp(value_(), min_(), max_()); - if (old_value != value_()) + if (old_value != value_()) { return true; + } return ComponentBase::OnEvent(event); } @@ -196,15 +197,17 @@ class SliderBase : public ComponentBase { class SliderWithLabel : public ComponentBase { public: - SliderWithLabel(ConstStringRef label, Component inner) : label_(label) { - Add(inner); - SetActiveChild(inner); + SliderWithLabel(ConstStringRef label, Component inner) + : label_(std::move(label)) { + Add(std::move(inner)); + SetActiveChild(ChildAt(0)); } private: bool OnEvent(Event event) final { - if (ComponentBase::OnEvent(event)) + if (ComponentBase::OnEvent(event)) { return true; + } if (!event.is_mouse()) { return false; @@ -272,7 +275,7 @@ Component Slider(ConstStringRef label, option.max = max; option.increment = increment; auto slider = Make>(option); - return Make(label, slider); + return Make(std::move(label), slider); } Component Slider(ConstStringRef label, @@ -286,7 +289,7 @@ Component Slider(ConstStringRef label, option.max = max; option.increment = increment; auto slider = Make>(option); - return Make(label, slider); + return Make(std::move(label), slider); } Component Slider(ConstStringRef label, Ref value, @@ -299,7 +302,7 @@ Component Slider(ConstStringRef label, option.max = max; option.increment = increment; auto slider = Make>(option); - return Make(label, slider); + return Make(std::move(label), slider); } /// @brief A slider in any direction.