Execute clang tidy and IWYU (#528)

This commit is contained in:
Arthur Sonzogni 2022-12-19 18:51:25 +01:00 committed by ArthurSonzogni
parent 4dc1a9fff9
commit 0542227ba7
No known key found for this signature in database
GPG Key ID: 41D98248C074CD6C
55 changed files with 315 additions and 298 deletions

View File

@ -1,4 +1,3 @@
#include <memory> // for shared_ptr
#include <string> // for operator+, to_string
#include "ftxui/component/captured_mouse.hpp" // for ftxui
@ -6,7 +5,7 @@
#include "ftxui/component/component_base.hpp" // for Component
#include "ftxui/component/component_options.hpp" // for ButtonOption
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for separator, Element, text, border
#include "ftxui/dom/elements.hpp" // for Element, separator, text, border
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Green, Color::Red
using namespace ftxui;

View File

@ -1,12 +1,12 @@
#include <stdlib.h> // for EXIT_SUCCESS
#include <chrono> // for milliseconds
#include <ftxui/component/event.hpp> // for Event
#include <ftxui/component/mouse.hpp> // for ftxui
#include <ftxui/dom/elements.hpp> // for text, separator, Element, operator|, vbox, border
#include <memory> // for shared_ptr
#include <string> // for operator+, to_string, allocator
#include <memory> // for allocator, shared_ptr
#include <string> // for operator+, to_string
#include <thread> // for sleep_for
#include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for CatchEvent, Renderer, operator|=
#include "ftxui/component/loop.hpp" // for Loop
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive

View File

@ -1,10 +1,9 @@
#include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <string> // for operator+, char_traits, to_string, string
#include <vector> // for vector
#include <ftxui/component/captured_mouse.hpp> // for ftxui
#include <string> // for allocator, operator+, char_traits, string
#include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Elements, Element, operator|, separator, text, focusPositionRelative, size, border, flex, frame, bgcolor, gridbox, vbox, EQUAL, center, HEIGHT, WIDTH
#include "ftxui/component/component.hpp" // for Renderer, Vertical
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive, Component
#include "ftxui/dom/elements.hpp" // for text, Decorator, focus, focusCursorBar, focusCursorBarBlinking, focusCursorBlock, focusCursorBlockBlinking, focusCursorUnderline, focusCursorUnderlineBlinking, hbox, Element
using namespace ftxui;

View File

@ -5,14 +5,14 @@
#include <cmath> // for sin
#include <functional> // for ref, reference_wrapper, function
#include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <string> // for string, basic_string, operator+, to_string, char_traits
#include <string> // for string, basic_string, char_traits, operator+, to_string
#include <thread> // for sleep_for, thread
#include <utility> // for move
#include <vector> // for vector
#include "../dom/color_info_sorted_2d.ipp" // for ColorInfoSorted2D
#include "ftxui/component/component.hpp" // for Checkbox, Renderer, Horizontal, Vertical, Input, Menu, Radiobox, ResizableSplitLeft, Tab
#include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component
#include "ftxui/component/component_options.hpp" // for MenuOption, InputOption
#include "ftxui/component/event.hpp" // for Event, Event::Custom
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive

View File

@ -1,12 +1,11 @@
#include <memory> // for shared_ptr
#include <string> // for string, basic_string, allocator
#include <string> // for string, allocator, basic_string
#include <vector> // for vector
#include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for operator|, Maybe, Checkbox, Radiobox, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for Component
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for border, color, operator|, text, Element
#include "ftxui/dom/elements.hpp" // for Element, border, color, operator|, text
#include "ftxui/screen/color.hpp" // for Color, Color::Red
using namespace ftxui;

View File

@ -1,14 +1,14 @@
#include <array> // for array
#include <chrono> // for milliseconds
#include <functional> // for function
#include <memory> // for shared_ptr, __shared_ptr_access, allocator
#include <string> // for string, char_traits, basic_string, operator+
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string, char_traits, operator+, basic_string
#include <vector> // for vector
#include "ftxui/component/animation.hpp" // for ElasticOut, Linear
#include "ftxui/component/component.hpp" // for Menu, Horizontal, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component_options.hpp" // for MenuOption, MenuEntryOption, AnimatedColorOption, AnimatedColorsOption, UnderlineOption
#include "ftxui/component/component_options.hpp" // for MenuOption, EntryState, MenuEntryOption, AnimatedColorOption, AnimatedColorsOption, UnderlineOption
#include "ftxui/component/mouse.hpp" // for ftxui
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
#include "ftxui/dom/elements.hpp" // for separator, operator|, Element, text, bgcolor, hbox, bold, color, filler, border, vbox, borderDouble, dim, flex, hcenter

View File

@ -1,6 +1,6 @@
#include <chrono> // for operator""ms, literals
#include <memory> // for shared_ptr, __shared_ptr_access, allocator
#include <string> // for string, basic_string, operator+, to_string
#include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <string> // for string, operator+, to_string, basic_string
#include <vector> // for vector
#include "ftxui/component/animation.hpp" // for BackOut, Duration

View File

@ -2,7 +2,7 @@
#include <ftxui/dom/elements.hpp> // for text, gauge, operator|, flex, hbox, Element
#include <ftxui/screen/screen.hpp> // for Screen
#include <iostream> // for cout, endl, ostream
#include <string> // for allocator, operator+, char_traits, operator<<, string, to_string, basic_string
#include <string> // for allocator, char_traits, operator+, operator<<, string, to_string, basic_string
#include <thread> // for sleep_for
#include "ftxui/dom/node.hpp" // for Render

View File

@ -1,8 +1,8 @@
#include <chrono> // for operator""s, chrono_literals
#include <ftxui/dom/elements.hpp> // for text, gauge, operator|, flex, hbox, Element
#include <ftxui/dom/elements.hpp> // for filler, operator|, separator, text, border, Element, vbox, vtext, hbox, center, gaugeDown, gaugeLeft, gaugeRight, gaugeUp
#include <ftxui/screen/screen.hpp> // for Screen
#include <iostream> // for cout, endl, ostream
#include <string> // for allocator, operator+, char_traits, operator<<, string, to_string, basic_string
#include <string> // for allocator, operator+, operator<<, string, to_string
#include <thread> // for sleep_for
#include "ftxui/dom/node.hpp" // for Render

View File

@ -1,8 +1,7 @@
#include <stdio.h> // for getchar
#include <ftxui/dom/elements.hpp> // for operator|, size, Element, text, hcenter, Decorator, Fit, WIDTH, hflow, window, EQUAL, GREATER_THAN, HEIGHT, bold, border, dim, LESS_THAN
#include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for shared_ptr
#include <string> // for allocator, operator+, to_string, char_traits, string
#include <string> // for allocator, char_traits, operator+, to_string, string
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui

View File

@ -1,7 +1,6 @@
#include <chrono> // for operator""s, chrono_literals
#include <ftxui/screen/screen.hpp> // for Screen
#include <iostream> // for cout, ostream
#include <memory> // for shared_ptr
#include <string> // for allocator, operator<<, string
#include <thread> // for sleep_for

View File

@ -2,7 +2,7 @@
#include <ftxui/dom/elements.hpp> // for operator|, text, Element, hbox, bold, color, filler, separator, vbox, window, gauge, Fit, size, dim, EQUAL, WIDTH
#include <ftxui/screen/screen.hpp> // for Full, Screen
#include <iostream> // for cout, endl, ostream
#include <list> // for list, operator!=, _List_iterator, _List_iterator<>::_Self
#include <list> // for list, operator==, _List_iterator, _List_iterator<>::_Self
#include <memory> // for allocator, shared_ptr, allocator_traits<>::value_type
#include <string> // for string, operator<<, to_string
#include <thread> // for sleep_for

View File

@ -1,8 +1,7 @@
#include <stdio.h> // for getchar
#include <ftxui/dom/elements.hpp> // for operator|, Element, size, text, hcenter, Fit, vflow, window, EQUAL, bold, border, dim, HEIGHT, WIDTH
#include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for shared_ptr
#include <string> // for allocator, operator+, to_string, char_traits, string
#include <string> // for allocator, char_traits, operator+, to_string, string
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui

View File

@ -66,9 +66,7 @@ struct Event {
std::string character() const { return input_; }
bool is_mouse() const { return type_ == Type::Mouse; }
struct Mouse& mouse() {
return mouse_;
}
struct Mouse& mouse() { return mouse_; }
bool is_cursor_reporting() const { return type_ == Type::CursorReporting; }
int cursor_x() const { return cursor_.x; }

View File

@ -1,4 +1,6 @@
[
{ include: ["<bits/chrono.h>", "private", "<chrono>", "public"]},
{ include: ["<bits/std_abs.h>", "private", "<cmath>", "public"]},
{ include: ["<bits/termios-c_cc.h>", "private", "<termios.h>", "public"]},
{ include: ["<bits/termios-c_lflag.h>", "private", "<termios.h>", "public"]},
{ include: ["<bits/termios-struct.h>", "private", "<termios.h>", "public"]},

View File

@ -58,7 +58,7 @@ float CubicIn(float p) {
// Modeled after the cubic y = (x - 1)^3 + 1
float CubicOut(float p) {
float f = (p - 1);
const float f = (p - 1);
return f * f * f + 1;
}
@ -69,7 +69,7 @@ float CubicInOut(float p) {
if (p < 0.5F) { // NOLINT
return 4 * p * p * p;
} else {
float f = ((2 * p) - 2);
const float f = ((2 * p) - 2);
return 0.5F * f * f * f + 1; // NOLINT
}
}
@ -81,7 +81,7 @@ float QuarticIn(float p) {
// Modeled after the quartic y = 1 - (x - 1)^4
float QuarticOut(float p) {
float f = (p - 1);
const float f = (p - 1);
return f * f * f * (1 - p) + 1;
}
@ -92,7 +92,7 @@ float QuarticInOut(float p) {
if (p < 0.5F) { // NOLINT
return 8 * p * p * p * p; // NOLINT
} else {
float f = (p - 1);
const float f = (p - 1);
return -8 * f * f * f * f + 1; // NOLINT
}
}
@ -104,7 +104,7 @@ float QuinticIn(float p) {
// Modeled after the quintic y = (x - 1)^5 + 1
float QuinticOut(float p) {
float f = (p - 1);
const float f = (p - 1);
return f * f * f * f * f + 1;
}
@ -214,7 +214,7 @@ float BackIn(float p) {
// Modeled after overshooting cubic y = 1-((1-x)^3-(1-x)*sin((1-x)*pi))
float BackOut(float p) {
float f = (1 - p);
const float f = (1 - p);
return 1 - (f * f * f - f * std::sin(f * kPi));
}
@ -223,7 +223,7 @@ float BackOut(float p) {
// y = (1/2)*(1-((1-x)^3-(1-x)*sin((1-x)*pi))+1) ; [0.5, 1]
float BackInOut(float p) {
if (p < 0.5F) { // NOLINT
float f = 2 * p;
const float f = 2 * p;
return 0.5F * (f * f * f - f * std::sin(f * kPi)); // NOLINT
} else {
float f = (1 - (2 * p - 1)); // NOLINT

View File

@ -80,7 +80,7 @@ Component Button(ConstStringRef label,
}
auto focus_management = focused ? focus : active ? select : nothing;
EntryState state = {
const EntryState state = {
*label_,
false,
active,

View File

@ -1,7 +1,7 @@
#include <gtest/gtest.h>
#include <chrono> // for operator""s, chrono_literals
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string
#include <gtest/gtest.h> // for AssertionResult, Message, TestPartResult, EXPECT_EQ, Test, EXPECT_FALSE, EXPECT_TRUE, TestInfo (ptr only), TEST
#include <chrono> // for operator""s, chrono_literals
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string
#include "ftxui/component/animation.hpp" // for Duration, Params
#include "ftxui/component/component.hpp" // for Button, Horizontal

View File

@ -1,9 +1,10 @@
#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 Component, Make, CatchEvent
#include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component.hpp" // for Make, CatchEvent, ComponentDecorator
#include "ftxui/component/component_base.hpp" // for Component, ComponentBase
#include "ftxui/component/event.hpp" // for Event
namespace ftxui {

View File

@ -22,8 +22,8 @@ class CheckboxBase : public ComponentBase {
private:
// Component implementation.
Element Render() override {
bool is_focused = Focused();
bool is_active = Active();
const bool is_focused = Focused();
const bool is_active = Active();
auto focus_management = is_focused ? focus : is_active ? select : nothing;
auto state = EntryState{
*label_,

View File

@ -26,7 +26,7 @@ namespace ftxui {
///
/// ▼ Show details
/// <details component>
/// ```
///  ```
Component Collapsible(ConstStringRef label, Component child, Ref<bool> show) {
class Impl : public ComponentBase {
public:

View File

@ -114,7 +114,7 @@ bool ComponentBase::OnEvent(Event event) { // NOLINT
/// The default implementation dispatch the event to every child.
/// @ingroup component
void ComponentBase::OnAnimation(animation::Params& params) {
for (Component& child : children_) {
for (const Component& child : children_) {
child->OnAnimation(params);
}
}

View File

@ -123,8 +123,8 @@ MenuOption MenuOption::Toggle() {
ButtonOption ButtonOption::Ascii() {
ButtonOption option;
option.transform = [](const EntryState& s) {
std::string label = s.focused ? "[" + s.label + "]" //
: " " + s.label + " ";
const std::string label = s.focused ? "[" + s.label + "]" //
: " " + s.label + " ";
return text(label);
};
return option;

View File

@ -82,8 +82,8 @@ class ContainerBase : public ComponentBase {
return;
}
for (size_t offset = 1; offset < children_.size(); ++offset) {
size_t i = ((size_t(*selector_ + offset * dir + children_.size())) %
children_.size());
const size_t i = ((size_t(*selector_ + offset * dir + children_.size())) %
children_.size());
if (children_[i]->Focusable()) {
*selector_ = (int)i;
return;
@ -108,7 +108,7 @@ class VerticalContainer : public ContainerBase {
}
bool EventHandler(Event event) override {
int old_selected = *selector_;
const int old_selected = *selector_;
if (event == Event::ArrowUp || event == Event::Character('k')) {
MoveSelector(-1);
}
@ -190,7 +190,7 @@ class HorizontalContainer : public ContainerBase {
}
bool EventHandler(Event event) override {
int old_selected = *selector_;
const int old_selected = *selector_;
if (event == Event::ArrowLeft || event == Event::Character('h')) {
MoveSelector(-1);
}
@ -214,7 +214,7 @@ class TabContainer : public ContainerBase {
using ContainerBase::ContainerBase;
Element Render() override {
Component active_child = ActiveChild();
const Component active_child = ActiveChild();
if (active_child) {
return active_child->Render();
}

View File

@ -1,15 +1,14 @@
#include <memory> // for shared_ptr
#include <utility> // for move
#include <ftxui/component/captured_mouse.hpp> // for CapturedMouse
#include <functional> // for function
#include <utility> // for move
#include "ftxui/component/component.hpp" // for Make, Button
#include "ftxui/component/component.hpp" // for ComponentDecorator, Hoverable, Make
#include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/event.hpp" // for Event, Event::Return
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Pressed
#include "ftxui/component/screen_interactive.hpp" // for Component
#include "ftxui/dom/elements.hpp" // for operator|, Decorator, Element, operator|=, bgcolor, color, reflect, text, bold, border, inverted, nothing
#include "ftxui/component/event.hpp" // for Event
#include "ftxui/component/mouse.hpp" // for Mouse
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, reflect, Element
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/color.hpp" // for Color
#include "ftxui/util/ref.hpp" // for Ref, ConstStringRef
namespace ftxui {
@ -23,7 +22,7 @@ void Post(std::function<void()> f) {
f();
}
} // namespace
} // namespace
/// @brief Wrap a component. Gives the ability to know if it is hovered by the
/// mouse.
@ -38,11 +37,12 @@ void Post(std::function<void()> f) {
/// bool hover = false;
/// auto button_hover = Hoverable(button, &hover);
/// ```
// NOLINTNEXTLINE
Component Hoverable(Component component, bool* hover) {
class Impl : public ComponentBase {
public:
Impl(Component component, bool* hover)
: component_(component), hover_(hover) {
: component_(std::move(component)), hover_(hover) {
Add(component_);
}
@ -102,8 +102,8 @@ Component Hoverable(Component component,
bool OnEvent(Event event) override {
if (event.is_mouse()) {
bool hover = box_.Contain(event.mouse().x, event.mouse().y) &&
CaptureMouse(event);
const bool hover = box_.Contain(event.mouse().x, event.mouse().y) &&
CaptureMouse(event);
if (hover != hover_) {
Post(hover ? on_enter_ : on_leave_);
}
@ -120,7 +120,8 @@ Component Hoverable(Component component,
std::function<void()> on_leave_;
};
return Make<Impl>(component, on_enter, on_leave);
return Make<Impl>(std::move(component), std::move(on_enter),
std::move(on_leave));
}
/// @brief Wrap a component. Gives the ability to know if it is hovered by the
@ -136,7 +137,9 @@ Component Hoverable(Component component,
/// button |= Hoverable(&hover);
/// ```
ComponentDecorator Hoverable(bool* hover) {
return [hover](Component component) { return Hoverable(component, hover); };
return [hover](Component component) {
return Hoverable(std::move(component), hover);
};
}
/// @brief Wrap a component. Gives the ability to know if it is hovered by the
@ -152,14 +155,16 @@ ComponentDecorator Hoverable(bool* hover) {
/// int on_enter_cnt = 0;
/// int on_leave_cnt = 0;
/// button |= Hoverable(
/// [&]{ on_enter_cnt++; },
/// [&]{ on_enter_cnt++; },
/// [&]{ on_leave_cnt++; }
// );
/// ```
// NOLINTNEXTLINE
ComponentDecorator Hoverable(std::function<void()> on_enter,
// NOLINTNEXTLINE
std::function<void()> on_leave) {
return [on_enter, on_leave](Component component) {
return Hoverable(component, on_enter, on_leave);
return Hoverable(std::move(component), on_enter, on_leave);
};
}
@ -177,9 +182,10 @@ ComponentDecorator Hoverable(std::function<void()> on_enter,
/// auto button_hoverable = Hoverable(button,
// [&](bool hover) { hovered = hover;});
/// ```
// NOLINTNEXTLINE
Component Hoverable(Component component, std::function<void(bool)> on_change) {
return Hoverable(
component, //
std::move(component), //
[on_change] { on_change(true); }, //
[on_change] { on_change(false); } //
);
@ -197,9 +203,10 @@ Component Hoverable(Component component, std::function<void(bool)> on_change) {
/// bool hovered = false;
/// button |= Hoverable([&](bool hover) { hovered = hover;});
/// ```
// NOLINTNEXTLINE
ComponentDecorator Hoverable(std::function<void(bool)> on_change) {
return [on_change](Component component) {
return Hoverable(component, on_change);
return Hoverable(std::move(component), on_change);
};
}

View File

@ -1,13 +1,13 @@
#include <gtest/gtest.h>
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string
#include <gtest/gtest.h> // for AssertionResult, Message, TestPartResult, EXPECT_FALSE, EXPECT_EQ, Test, EXPECT_TRUE, TestInfo (ptr only), TEST
#include <ftxui/dom/elements.hpp> // for Element, text
#include <memory> // for shared_ptr, __shared_ptr_access, allocator
#include "ftxui/component/component.hpp" // for Input
#include "ftxui/component/component.hpp" // for Hoverable, Horizontal, operator|=, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component
#include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Backspace, Event::Delete, Event::End, Event::Home
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Button, Mouse::Left, Mouse::Motion, Mouse::Pressed
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/screen.hpp" // for Screen
#include "ftxui/component/event.hpp" // for Event
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Released
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/screen.hpp" // for Screen
namespace ftxui {

View File

@ -1,6 +1,7 @@
#include <algorithm> // for max, min
#include <cstddef> // for size_t
#include <functional> // for function
#include <memory> // for shared_ptr
#include <string> // for string, allocator
#include <utility> // for move
#include <vector> // for vector
@ -9,14 +10,14 @@
#include "ftxui/component/component.hpp" // for Make, Input
#include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component_options.hpp" // for InputOption
#include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Backspace, Event::Custom, Event::Delete, Event::End, Event::Home, Event::Return
#include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowLeftCtrl, Event::ArrowRight, Event::ArrowRightCtrl, Event::Backspace, Event::Custom, Event::Delete, Event::End, Event::Home, Event::Return
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Pressed
#include "ftxui/component/screen_interactive.hpp" // for Component
#include "ftxui/dom/elements.hpp" // for operator|, text, Element, reflect, inverted, Decorator, flex, focus, hbox, size, bold, dim, frame, select, EQUAL, HEIGHT
#include "ftxui/dom/elements.hpp" // for operator|, text, Element, reflect, operator|=, flex, inverted, hbox, size, bold, dim, focus, focusCursorBarBlinking, frame, select, Decorator, EQUAL, HEIGHT
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/string.hpp" // for GlyphPosition, GlyphCount, CellToGlyphIndex
#include "ftxui/screen/util.hpp" // for clamp
#include "ftxui/util/ref.hpp" // for StringRef, Ref, ConstStringRef
#include "ftxui/screen/string.hpp" // for GlyphPosition, WordBreakProperty, GlyphCount, Utf8ToWordBreakProperty, CellToGlyphIndex, WordBreakProperty::ALetter, WordBreakProperty::CR, WordBreakProperty::Double_Quote, WordBreakProperty::Extend, WordBreakProperty::ExtendNumLet, WordBreakProperty::Format, WordBreakProperty::Hebrew_Letter, WordBreakProperty::Katakana, WordBreakProperty::LF, WordBreakProperty::MidLetter, WordBreakProperty::MidNum, WordBreakProperty::MidNumLet, WordBreakProperty::Newline, WordBreakProperty::Numeric, WordBreakProperty::Regional_Indicator, WordBreakProperty::Single_Quote, WordBreakProperty::WSegSpace, WordBreakProperty::ZWJ
#include "ftxui/screen/util.hpp" // for clamp
#include "ftxui/util/ref.hpp" // for StringRef, Ref, ConstStringRef
namespace ftxui {
@ -49,7 +50,7 @@ bool IsWordCharacter(WordBreakProperty property) {
case WordBreakProperty::ZWJ:
return false;
}
return true; // NOT_REACHED();
return true; // NOT_REACHED();
}
std::string PasswordField(size_t size) {
@ -86,13 +87,14 @@ class InputBase : public ComponentBase {
if (option_->password()) {
password_content = PasswordField(content_->size());
}
std::string& content = option_->password() ? password_content : *content_;
const std::string& content =
option_->password() ? password_content : *content_;
int size = GlyphCount(content);
const int size = GlyphCount(content);
cursor_position() = std::max(0, std::min<int>(size, cursor_position()));
auto main_decorator = flex | ftxui::size(HEIGHT, EQUAL, 1);
bool is_focused = Focused();
const bool is_focused = Focused();
// placeholder.
if (size == 0) {
@ -100,7 +102,7 @@ class InputBase : public ComponentBase {
if (is_focused) {
element |= focus;
}
if (hovered_|| is_focused) {
if (hovered_ || is_focused) {
element |= inverted;
}
return element;
@ -111,19 +113,21 @@ class InputBase : public ComponentBase {
auto element = text(content) | main_decorator | reflect(box_);
if (hovered_) {
element |= inverted;
}
}
return element;
}
int index_before_cursor = GlyphPosition(content, cursor_position());
int index_after_cursor = GlyphPosition(content, 1, index_before_cursor);
std::string part_before_cursor = content.substr(0, index_before_cursor);
const int index_before_cursor = GlyphPosition(content, cursor_position());
const int index_after_cursor =
GlyphPosition(content, 1, index_before_cursor);
const std::string part_before_cursor =
content.substr(0, index_before_cursor);
std::string part_at_cursor = " ";
if (cursor_position() < size) {
part_at_cursor = content.substr(index_before_cursor,
index_after_cursor - index_before_cursor);
}
std::string part_after_cursor = content.substr(index_after_cursor);
const std::string part_after_cursor = content.substr(index_after_cursor);
auto focused = (is_focused || hovered_) ? focusCursorBarBlinking : select;
return hbox({
text(part_before_cursor),
@ -140,15 +144,14 @@ class InputBase : public ComponentBase {
if (event.is_mouse()) {
return OnMouseEvent(event);
}
std::string c;
// Backspace.
if (event == Event::Backspace) {
if (cursor_position() == 0) {
return false;
}
size_t start = GlyphPosition(*content_, cursor_position() - 1);
size_t end = GlyphPosition(*content_, cursor_position());
const size_t start = GlyphPosition(*content_, cursor_position() - 1);
const size_t end = GlyphPosition(*content_, cursor_position());
content_->erase(start, end - start);
cursor_position()--;
option_->on_change();
@ -160,8 +163,8 @@ class InputBase : public ComponentBase {
if (cursor_position() == int(content_->size())) {
return false;
}
size_t start = GlyphPosition(*content_, cursor_position());
size_t end = GlyphPosition(*content_, cursor_position() + 1);
const size_t start = GlyphPosition(*content_, cursor_position());
const size_t end = GlyphPosition(*content_, cursor_position() + 1);
content_->erase(start, end - start);
option_->on_change();
return true;
@ -211,7 +214,7 @@ class InputBase : public ComponentBase {
// Content
if (event.is_character()) {
size_t start = GlyphPosition(*content_, cursor_position());
const size_t start = GlyphPosition(*content_, cursor_position());
content_->insert(start, event.character());
cursor_position()++;
option_->on_change();
@ -239,7 +242,7 @@ class InputBase : public ComponentBase {
void HandleRightCtrl() {
auto properties = Utf8ToWordBreakProperty(*content_);
int max = (int)properties.size();
const int max = (int)properties.size();
// Move right, as long as right is not a word character.
while (cursor_position() < max &&
@ -284,7 +287,8 @@ class InputBase : public ComponentBase {
if (mapping[original_cell] != original_glyph) {
original_cell = mapping.size();
}
int target_cell = int(original_cell) + event.mouse().x - cursor_box_.x_min;
const int target_cell =
int(original_cell) + event.mouse().x - cursor_box_.x_min;
int target_glyph = target_cell < (int)mapping.size() ? mapping[target_cell]
: (int)mapping.size();
target_glyph = util::clamp(target_glyph, 0, GlyphCount(*content_));

View File

@ -1,5 +1,8 @@
#include "ftxui/component/loop.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include <utility> // for move
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive, Component
namespace ftxui {

View File

@ -1,6 +1,7 @@
#include <functional> // for function
#include <memory> // for make_unique, __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 ComponentDecorator, Maybe, Make
#include "ftxui/component/component_base.hpp" // for Component, ComponentBase

View File

@ -1,16 +1,16 @@
#include <algorithm> // for max, reverse
#include <algorithm> // for max, fill_n, reverse
#include <chrono> // for milliseconds
#include <functional> // for function
#include <memory> // for allocator, shared_ptr, allocator_traits<>::value_type, swap
#include <string> // for char_traits, operator+, string, basic_string
#include <utility> // for move
#include <vector> // for vector, __alloc_traits<>::value_type
#include <memory> // for allocator_traits<>::value_type, swap
#include <string> // for operator+, string
#include <utility> // for move
#include <vector> // for vector, __alloc_traits<>::value_type
#include "ftxui/component/animation.hpp" // for Animator, Linear, Params (ptr only)
#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_base.hpp" // for ComponentBase
#include "ftxui/component/component_options.hpp" // for MenuOption, MenuEntryOption, MenuOption::Direction, UnderlineOption, AnimatedColorOption, AnimatedColorsOption, MenuOption::Down, MenuOption::Left, MenuOption::Right, MenuOption::Up
#include "ftxui/component/component_options.hpp" // for MenuOption, MenuEntryOption, MenuOption::Direction, UnderlineOption, AnimatedColorOption, AnimatedColorsOption, EntryState, MenuOption::Down, MenuOption::Left, MenuOption::Right, MenuOption::Up
#include "ftxui/component/event.hpp" // for Event, Event::ArrowDown, Event::ArrowLeft, Event::ArrowRight, Event::ArrowUp, Event::End, Event::Home, Event::PageDown, Event::PageUp, Event::Return, Event::Tab, Event::TabReverse
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Released, Mouse::WheelDown, Mouse::WheelUp, Mouse::None
#include "ftxui/component/screen_interactive.hpp" // for Component
@ -109,7 +109,7 @@ class MenuBase : public ComponentBase {
UpdateAnimationTarget();
Elements elements;
bool is_menu_focused = Focused();
const bool is_menu_focused = Focused();
if (option_->elements_prefix) {
elements.push_back(option_->elements_prefix());
}
@ -117,10 +117,10 @@ class MenuBase : public ComponentBase {
if (i != 0 && option_->elements_infix) {
elements.push_back(option_->elements_infix());
}
bool is_focused = (focused_entry() == i) && is_menu_focused;
bool is_selected = (*selected_ == i);
const bool is_focused = (focused_entry() == i) && is_menu_focused;
const bool is_selected = (*selected_ == i);
EntryState state = {
const EntryState state = {
entries_[i],
false,
is_selected,
@ -130,7 +130,7 @@ class MenuBase : public ComponentBase {
auto focus_management =
is_menu_focused && (selected_focus_ == i) ? focus : nothing;
Element element =
const Element element =
(option_->entries.transform ? option_->entries.transform
: DefaultOptionTransform) //
(state);
@ -145,7 +145,7 @@ class MenuBase : public ComponentBase {
std::reverse(elements.begin(), elements.end());
}
Element bar =
const Element bar =
IsHorizontal() ? hbox(std::move(elements)) : vbox(std::move(elements));
if (!option_->underline.enabled) {
@ -244,7 +244,7 @@ class MenuBase : public ComponentBase {
}
if (Focused()) {
int old_selected = *selected_;
const int old_selected = *selected_;
if (event == Event::ArrowUp || event == Event::Character('k')) {
OnUp();
}
@ -331,7 +331,7 @@ class MenuBase : public ComponentBase {
if (!box_.Contain(event.mouse().x, event.mouse().y)) {
return false;
}
int old_selected = *selected_;
const int old_selected = *selected_;
if (event.mouse().button == Mouse::WheelUp) {
(*selected_)--;
@ -373,10 +373,10 @@ class MenuBase : public ComponentBase {
}
}
bool is_menu_focused = Focused();
const bool is_menu_focused = Focused();
for (int i = 0; i < size(); ++i) {
bool is_focused = (focused_entry() == i) && is_menu_focused;
bool is_selected = (*selected_ == i);
const bool is_focused = (focused_entry() == i) && is_menu_focused;
const bool is_selected = (*selected_ == i);
float target = is_selected ? 1.F : is_focused ? 0.5F : 0.F; // NOLINT
if (animator_background_[i].to() != target) {
animator_background_[i] = animation::Animator(
@ -447,16 +447,16 @@ class MenuBase : public ComponentBase {
if (boxes_.empty()) {
return 0.F;
}
int value = IsHorizontal() ? boxes_[*selected_].x_min - box_.x_min
: boxes_[*selected_].y_min - box_.y_min;
const int value = IsHorizontal() ? boxes_[*selected_].x_min - box_.x_min
: boxes_[*selected_].y_min - box_.y_min;
return float(value);
}
float SecondTarget() {
if (boxes_.empty()) {
return 0.F;
}
int value = IsHorizontal() ? boxes_[*selected_].x_max - box_.x_min
: boxes_[*selected_].y_max - box_.y_min;
const int value = IsHorizontal() ? boxes_[*selected_].x_max - box_.x_min
: boxes_[*selected_].y_max - box_.y_min;
return float(value);
}
@ -557,17 +557,17 @@ Component MenuEntry(ConstStringRef label, Ref<MenuEntryOption> option) {
private:
Element Render() override {
bool focused = Focused();
const bool focused = Focused();
UpdateAnimationTarget();
EntryState state = {
const EntryState state = {
*label_,
false,
hovered_,
focused,
};
Element element =
const Element element =
(option_->transform ? option_->transform : DefaultOptionTransform) //
(state);
@ -576,7 +576,7 @@ Component MenuEntry(ConstStringRef label, Ref<MenuEntryOption> option) {
}
void UpdateAnimationTarget() {
bool focused = Focused();
const bool focused = Focused();
float target = focused ? 1.F : hovered_ ? 0.5F : 0.F; // NOLINT
if (target == animator_background_.to()) {
return;

View File

@ -1,7 +1,7 @@
#include <gtest/gtest.h>
#include <gtest/gtest.h> // for Test, EXPECT_EQ, Message, TestPartResult, TestInfo (ptr only), TEST
#include <chrono> // for operator""s, chrono_literals
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string
#include <string> // for string, basic_string
#include <vector> // for vector
#include "ftxui/component/animation.hpp" // for Duration, Params

View File

@ -32,10 +32,10 @@ class RadioboxBase : public ComponentBase {
Element Render() override {
Clamp();
Elements elements;
bool is_menu_focused = Focused();
const bool is_menu_focused = Focused();
for (int i = 0; i < size(); ++i) {
bool is_focused = (focused_entry() == i) && is_menu_focused;
bool is_selected = (hovered_ == i);
const bool is_focused = (focused_entry() == i) && is_menu_focused;
const bool is_selected = (hovered_ == i);
auto focus_management = !is_selected ? nothing
: is_menu_focused ? focus
: select;
@ -66,7 +66,7 @@ class RadioboxBase : public ComponentBase {
}
if (Focused()) {
int old_hovered = hovered_;
const int old_hovered = hovered_;
if (event == Event::ArrowUp || event == Event::Character('k')) {
(hovered_)--;
}
@ -141,7 +141,7 @@ class RadioboxBase : public ComponentBase {
return false;
}
int old_hovered = hovered_;
const int old_hovered = hovered_;
if (event.mouse().button == Mouse::WheelUp) {
(hovered_)--;

View File

@ -1,12 +1,15 @@
#include <gtest/gtest.h>
#include <gtest/gtest.h> // for AssertionResult, Message, TestPartResult, EXPECT_EQ, EXPECT_TRUE, Test, TestInfo (ptr only), EXPECT_FALSE, TEST
#include <ftxui/dom/elements.hpp> // for yframe
#include <ftxui/dom/node.hpp> // for Render
#include <ftxui/screen/screen.hpp> // for Screen
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
#include <string> // for string
#include <string> // for string, basic_string
#include <vector> // for vector
#include "ftxui/component/component.hpp" // for Radiobox
#include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component.hpp" // for Radiobox, operator|
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component
#include "ftxui/component/component_options.hpp" // for RadioboxOption
#include "ftxui/component/event.hpp" // for Event, Event::Return, Event::ArrowDown, Event::ArrowUp, Event::Tab, Event::TabReverse
#include "ftxui/component/event.hpp" // for Event, Event::Return, Event::ArrowDown, Event::End, Event::Home, Event::Tab, Event::TabReverse, Event::PageDown, Event::PageUp, Event::ArrowUp
#include "ftxui/util/ref.hpp" // for Ref
namespace ftxui {

View File

@ -1,19 +1,19 @@
#include <algorithm> // for copy, max, min
#include <array> // for array
#include <chrono> // for operator-, milliseconds, duration, operator>=, time_point, common_type<>::type
#include <csignal> // for signal, raise, SIGTSTP, SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGWINCH
#include <cstdio> // for fileno, size_t, stdin
#include <chrono> // for operator-, milliseconds, operator>=, duration, common_type<>::type, time_point
#include <csignal> // for signal, SIGTSTP, SIGABRT, SIGWINCH, raise, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, __sighandler_t, size_t
#include <cstdio> // for fileno, stdin
#include <ftxui/component/task.hpp> // for Task, Closure, AnimationTask
#include <ftxui/screen/screen.hpp> // for Pixel, Screen::Cursor, Screen
#include <functional> // for function
#include <initializer_list> // for initializer_list
#include <iostream> // for cout, ostream, basic_ostream, operator<<, endl, flush
#include <ftxui/screen/screen.hpp> // for Pixel, Screen::Cursor, Screen, Screen::Cursor::Hidden
#include <functional> // for function
#include <initializer_list> // for initializer_list
#include <iostream> // for cout, ostream, operator<<, basic_ostream, endl, flush
#include <stack> // for stack
#include <thread> // for thread, sleep_for
#include <tuple>
#include <tuple> // for _Swallow_assign, ignore
#include <type_traits> // for decay_t
#include <utility> // for move, swap
#include <variant> // for visit
#include <variant> // for visit, variant
#include <vector> // for vector
#include "ftxui/component/animation.hpp" // for TimePoint, Clock, Duration, Params, RequestAnimationFrame
@ -21,7 +21,7 @@
#include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/event.hpp" // for Event
#include "ftxui/component/loop.hpp" // for Loop
#include "ftxui/component/receiver.hpp" // for Sender, ReceiverImpl, MakeReceiver, SenderImpl, Receiver
#include "ftxui/component/receiver.hpp" // for ReceiverImpl, Sender, MakeReceiver, SenderImpl, Receiver
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/component/terminal_input_parser.hpp" // for TerminalInputParser
#include "ftxui/dom/node.hpp" // for Node, Render
@ -39,7 +39,7 @@
#error Must be compiled in UNICODE mode
#endif
#else
#include <sys/select.h> // for select, FD_ISSET, FD_SET, FD_ZERO, fd_set
#include <sys/select.h> // for select, FD_ISSET, FD_SET, FD_ZERO, fd_set, timeval
#include <termios.h> // for tcsetattr, termios, tcgetattr, TCSANOW, cc_t, ECHO, ICANON, VMIN, VTIME
#include <unistd.h> // for STDIN_FILENO, read
#endif
@ -150,8 +150,6 @@ void ftxui_on_resize(int columns, int rows) {
#else // POSIX (Linux & Mac)
#include <sys/time.h> // for timeval
int CheckStdinReady(int usec_timeout) {
timeval tv = {0, usec_timeout};
fd_set fds;
@ -189,10 +187,10 @@ void OnExit() {
}
}
std::atomic<int> g_signal_exit_count = 0;
std::atomic<int> g_signal_exit_count = 0; // NOLINT
#if !defined(_WIN32)
std::atomic<int> g_signal_stop_count = 0;
std::atomic<int> g_signal_resize_count = 0;
std::atomic<int> g_signal_stop_count = 0; // NOLINT
std::atomic<int> g_signal_resize_count = 0; // NOLINT
#endif
// Async signal safe function
@ -276,7 +274,7 @@ enum class DSRMode {
std::string Serialize(const std::vector<DECMode>& parameters) {
bool first = true;
std::string out;
for (DECMode parameter : parameters) {
for (const DECMode parameter : parameters) {
if (!first) {
out += ";";
}
@ -491,7 +489,7 @@ void ScreenInteractive::Install() {
// Install signal handlers to restore the terminal state on exit. The default
// signal handlers are restored on exit.
for (int signal : {SIGTERM, SIGSEGV, SIGINT, SIGILL, SIGABRT, SIGFPE}) {
for (const int signal : {SIGTERM, SIGSEGV, SIGINT, SIGILL, SIGABRT, SIGFPE}) {
InstallSignalHandler(signal);
}
@ -527,7 +525,7 @@ void ScreenInteractive::Install() {
SetConsoleMode(stdin_handle, in_mode);
SetConsoleMode(stdout_handle, out_mode);
#else
for (int signal : {SIGWINCH, SIGTSTP}) {
for (const int signal : {SIGWINCH, SIGTSTP}) {
InstallSignalHandler(signal);
}
@ -653,8 +651,8 @@ void ScreenInteractive::HandleTask(Component component, Task& task) {
}
animation_requested_ = false;
animation::TimePoint now = animation::Clock::now();
animation::Duration delta = now - previous_animation_time_;
const animation::TimePoint now = animation::Clock::now();
const animation::Duration delta = now - previous_animation_time_;
previous_animation_time_ = now;
animation::Params params(delta);
@ -697,7 +695,7 @@ void ScreenInteractive::Draw(Component component) {
break;
}
bool resized = (dimx != dimx_) || (dimy != dimy_);
const bool resized = (dimx != dimx_) || (dimy != dimy_);
ResetCursorPosition();
std::cout << ResetPosition(/*clear=*/resized);
@ -742,8 +740,8 @@ void ScreenInteractive::Draw(Component component) {
reset_cursor_position = "";
{
int dx = dimx_ - 1 - cursor_.x;
int dy = dimy_ - 1 - cursor_.y;
const int dx = dimx_ - 1 - cursor_.x;
const int dy = dimy_ - 1 - cursor_.y;
if (dy != 0) {
set_cursor_position += "\x1B[" + std::to_string(dy) + "A";

View File

@ -1,6 +1,7 @@
#include <algorithm> // for max, min
#include <ftxui/component/component_options.hpp> // for SliderOption
#include <string> // for allocator
#include <utility> // for move
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/component.hpp" // for Make, Slider
@ -12,7 +13,7 @@
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/color.hpp" // for Color, Color::GrayDark, Color::White
#include "ftxui/screen/util.hpp" // for clamp
#include "ftxui/util/ref.hpp" // for ConstRef, ConstStringRef, Ref
#include "ftxui/util/ref.hpp" // for ConstRef, Ref, ConstStringRef
namespace ftxui {
@ -43,7 +44,7 @@ class SliderBase : public ComponentBase {
Element Render() override {
auto gauge_color = Focused() ? color(options_->color_active)
: color(options_->color_inactive);
float percent = float(value_() - min_()) / float(max_() - min_());
const float percent = float(value_() - min_()) / float(max_() - min_());
return gaugeDirection(percent, options_->direction) |
flexDirection(options_->direction) | reflect(gauge_box_) |
gauge_color;

View File

@ -12,7 +12,7 @@ void ComputeGrow(std::vector<Element>* elements,
int extra_space,
int flex_grow_sum) {
for (Element& element : *elements) {
int added_space =
const int added_space =
extra_space * element.flex_grow / std::max(flex_grow_sum, 1);
extra_space -= added_space;
flex_grow_sum -= element.flex_grow;
@ -27,8 +27,8 @@ void ComputeShrinkEasy(std::vector<Element>* elements,
int extra_space,
int flex_shrink_sum) {
for (Element& element : *elements) {
int added_space = extra_space * element.min_size * element.flex_shrink /
std::max(flex_shrink_sum, 1);
const int added_space = extra_space * element.min_size *
element.flex_shrink / std::max(flex_shrink_sum, 1);
extra_space -= added_space;
flex_shrink_sum -= element.flex_shrink * element.min_size;
element.size = element.min_size + added_space;
@ -48,7 +48,7 @@ void ComputeShrinkHard(std::vector<Element>* elements,
continue;
}
int added_space = extra_space * element.min_size / std::max(1, size);
const int added_space = extra_space * element.min_size / std::max(1, size);
extra_space -= added_space;
size -= element.min_size;
@ -73,7 +73,7 @@ void Compute(std::vector<Element>* elements, int target_size) {
size += element.min_size;
}
int extra_space = target_size - size;
const int extra_space = target_size - size;
if (extra_space >= 0) {
ComputeGrow(elements, extra_space, flex_grow_sum);
} else if (flex_shrink_size + extra_space >= 0) {

View File

@ -1,6 +1,7 @@
#include "ftxui/dom/canvas.hpp"
#include <algorithm> // for max, min
#include <cmath> // for abs
#include <cstdint> // for uint8_t
#include <cstdlib> // for abs
#include <ftxui/screen/color.hpp> // for Color
@ -469,7 +470,7 @@ void Canvas::DrawBlockOn(int x, int y) {
cell.type = CellType::kBlock;
}
uint8_t bit = (x % 2) * 2 + y % 2;
const uint8_t bit = (x % 2) * 2 + y % 2;
uint8_t value = g_map_block_inversed.at(cell.content.character);
value |= 1U << bit;
cell.content.character = g_map_block[value];
@ -489,7 +490,7 @@ void Canvas::DrawBlockOff(int x, int y) {
}
y /= 2;
uint8_t bit = (y % 2) * 2 + x % 2;
const uint8_t bit = (y % 2) * 2 + x % 2;
uint8_t value = g_map_block_inversed.at(cell.content.character);
value &= ~(1U << bit);
cell.content.character = g_map_block[value];
@ -510,7 +511,7 @@ void Canvas::DrawBlockToggle(int x, int y) {
}
y /= 2;
uint8_t bit = (y % 2) * 2 + x % 2;
const uint8_t bit = (y % 2) * 2 + x % 2;
uint8_t value = g_map_block_inversed.at(cell.content.character);
value ^= 1U << bit;
cell.content.character = g_map_block[value];
@ -829,8 +830,8 @@ class CanvasNodeBase : public Node {
void Render(Screen& screen) override {
const Canvas& c = canvas();
int y_max = std::min(c.height() / 4, box_.y_max - box_.y_min + 1);
int x_max = std::min(c.width() / 2, box_.x_max - box_.x_min + 1);
const int y_max = std::min(c.height() / 4, box_.y_max - box_.y_min + 1);
const int x_max = std::min(c.width() / 2, box_.x_max - box_.x_min + 1);
for (int y = 0; y < y_max; ++y) {
for (int x = 0; x < x_max; ++x) {
screen.PixelAt(box_.x_min + x, box_.y_min + y) = c.GetPixel(x, y);
@ -873,8 +874,8 @@ Element canvas(int width, int height, std::function<void(Canvas&)> fn) {
}
void Render(Screen& screen) final {
int width = (box_.x_max - box_.x_min + 1) * 2;
int height = (box_.y_max - box_.y_min + 1) * 4;
const int width = (box_.x_max - box_.x_min + 1) * 2;
const int height = (box_.y_max - box_.y_min + 1) * 4;
canvas_ = Canvas(width, height);
fn_(canvas_);
CanvasNodeBase::Render(screen);

View File

@ -145,7 +145,7 @@ class Flexbox : public Node {
void SetBox(Box box) override {
Node::SetBox(box);
int asked_previous = asked_;
const int asked_previous = asked_;
asked_ = std::min(asked_, IsColumnOriented() ? box.y_max - box.y_min + 1
: box.x_max - box.x_min + 1);
need_iteration_ = (asked_ != asked_previous);
@ -166,7 +166,7 @@ class Flexbox : public Node {
children_box.x_max = box.x_min + b.x + b.dim_x - 1;
children_box.y_max = box.y_min + b.y + b.dim_y - 1;
Box intersection = Box::Intersection(children_box, box);
const Box intersection = Box::Intersection(children_box, box);
child->SetBox(intersection);
need_iteration_ |= (intersection != children_box);

View File

@ -162,9 +162,9 @@ void SetY(Global& g, std::vector<Line> lines) {
case FlexboxConfig::AlignContent::Stretch: {
for (int i = ys.size() - 1; i >= 0; --i) { // NOLINT
int shifted = remaining_space * (i + 0) / (i + 1);
const int shifted = remaining_space * (i + 0) / (i + 1);
ys[i] += shifted;
int consumed = remaining_space - shifted;
const int consumed = remaining_space - shifted;
elements[i].size += consumed;
remaining_space -= consumed;
}
@ -200,10 +200,10 @@ void SetY(Global& g, std::vector<Line> lines) {
for (size_t i = 0; i < lines.size(); ++i) {
auto& element = elements[i];
for (auto* block : lines[i].blocks) {
bool stretch =
const bool stretch =
block->flex_grow_y != 0 ||
g.config.align_content == FlexboxConfig::AlignContent::Stretch;
int size =
const int size =
stretch ? element.size : std::min(element.size, block->min_size_y);
switch (g.config.align_items) {
case FlexboxConfig::AlignItems::FlexStart: {

View File

@ -102,9 +102,9 @@ class Frame : public Node {
Box children_box = box;
if (x_frame_) {
int external_dimx = box.x_max - box.x_min;
int internal_dimx = std::max(requirement_.min_x, external_dimx);
int focused_dimx = selected_box.x_max - selected_box.x_min;
const int external_dimx = box.x_max - box.x_min;
const int internal_dimx = std::max(requirement_.min_x, external_dimx);
const int focused_dimx = selected_box.x_max - selected_box.x_min;
int dx = selected_box.x_min - external_dimx / 2 + focused_dimx / 2;
dx = std::max(0, std::min(internal_dimx - external_dimx - 1, dx));
children_box.x_min = box.x_min - dx;
@ -112,9 +112,9 @@ class Frame : public Node {
}
if (y_frame_) {
int external_dimy = box.y_max - box.y_min;
int internal_dimy = std::max(requirement_.min_y, external_dimy);
int focused_dimy = selected_box.y_max - selected_box.y_min;
const int external_dimy = box.y_max - box.y_min;
const int internal_dimy = std::max(requirement_.min_y, external_dimy);
const int focused_dimy = selected_box.y_max - selected_box.y_min;
int dy = selected_box.y_min - external_dimy / 2 + focused_dimy / 2;
dy = std::max(0, std::min(internal_dimy - external_dimy - 1, dy));
children_box.y_min = box.y_min - dy;
@ -125,8 +125,8 @@ class Frame : public Node {
}
void Render(Screen& screen) override {
AutoReset<Box> stencil(&screen.stencil,
Box::Intersection(box_, screen.stencil));
const AutoReset<Box> stencil(&screen.stencil,
Box::Intersection(box_, screen.stencil));
children_[0]->Render(screen);
}

View File

@ -90,17 +90,17 @@ class Gauge : public Node {
}
void RenderHorizontal(Screen& screen, bool invert) {
int y = box_.y_min;
const int y = box_.y_min;
if (y > box_.y_max) {
return;
}
// Draw the progress bar horizontally.
{
float progress = invert ? 1.F - progress_ : progress_;
float limit =
const float progress = invert ? 1.F - progress_ : progress_;
const float limit =
(float)box_.x_min + progress * (float)(box_.x_max - box_.x_min + 1);
int limit_int = (int)limit;
const int limit_int = (int)limit;
int x = box_.x_min;
while (x < limit_int) {
screen.at(x++, y) = charset_horizontal[9]; // NOLINT
@ -120,17 +120,17 @@ class Gauge : public Node {
}
void RenderVertical(Screen& screen, bool invert) {
int x = box_.x_min;
const int x = box_.x_min;
if (x > box_.x_max) {
return;
}
// Draw the progress bar vertically:
{
float progress = invert ? progress_ : 1.F - progress_;
float limit =
const float progress = invert ? progress_ : 1.F - progress_;
const float limit =
(float)box_.y_min + progress * (float)(box_.y_max - box_.y_min + 1);
int limit_int = (int)limit;
const int limit_int = (int)limit;
int y = box_.y_min;
while (y < limit_int) {
screen.at(x, y++) = charset_vertical[8]; // NOLINT

View File

@ -37,15 +37,15 @@ class Graph : public Node {
}
void Render(Screen& screen) override {
int width = (box_.x_max - box_.x_min + 1) * 2;
int height = (box_.y_max - box_.y_min + 1) * 2;
const int width = (box_.x_max - box_.x_min + 1) * 2;
const int height = (box_.y_max - box_.y_min + 1) * 2;
auto data = graph_function_(width, height);
int i = 0;
for (int x = box_.x_min; x <= box_.x_max; ++x) {
int height_1 = 2 * box_.y_max - data[i++];
int height_2 = 2 * box_.y_max - data[i++];
const int height_1 = 2 * box_.y_max - data[i++];
const int height_2 = 2 * box_.y_max - data[i++];
for (int y = box_.y_min; y <= box_.y_max; ++y) {
int yy = 2 * y;
const int yy = 2 * y;
int i_1 = yy < height_1 ? 0 : yy == height_1 ? 3 : 6; // NOLINT
int i_2 = yy < height_2 ? 0 : yy == height_2 ? 1 : 2; // NOLINT
screen.at(x, y) = charset[i_1 + i_2]; // NOLINT

View File

@ -22,7 +22,7 @@ namespace {
int Integrate(std::vector<int>& elements) {
int accu = 0;
for (auto& i : elements) {
int old_accu = accu;
const int old_accu = accu;
accu += i;
i = old_accu;
}
@ -113,8 +113,8 @@ class GridBox : public Node {
}
}
int target_size_x = box.x_max - box.x_min + 1;
int target_size_y = box.y_max - box.y_min + 1;
const int target_size_x = box.x_max - box.x_min + 1;
const int target_size_y = box.y_max - box.y_min + 1;
box_helper::Compute(&elements_x, target_size_x);
box_helper::Compute(&elements_y, target_size_y);
@ -165,15 +165,15 @@ class GridBox : public Node {
/// ```
/// Output:
/// ```
///╭──────────╮╭──────╮╭──────────╮
///│north-west││north ││north-east│
///╰──────────╯╰──────╯╰──────────╯
///╭──────────╮╭──────╮╭──────────╮
///│west ││center││east │
///╰──────────╯╰──────╯╰──────────╯
///╭──────────╮╭──────╮╭──────────╮
///│south-west││south ││south-east│
///╰──────────╯╰──────╯╰──────────╯
/// ╭──────────╮╭──────╮╭──────────╮
/// │north-west││north ││north-east│
/// ╰──────────╯╰──────╯╰──────────╯
/// ╭──────────╮╭──────╮╭──────────╮
/// │west ││center││east │
/// ╰──────────╯╰──────╯╰──────────╯
/// ╭──────────╮╭──────╮╭──────────╮
/// │south-west││south ││south-east│
/// ╰──────────╯╰──────╯╰──────────╯
/// ```
Element gridbox(std::vector<Elements> lines) {
return std::make_shared<GridBox>(std::move(lines));

View File

@ -49,7 +49,7 @@ class HBox : public Node {
element.flex_grow = requirement.flex_grow_x;
element.flex_shrink = requirement.flex_shrink_x;
}
int target_size = box.x_max - box.x_min + 1;
const int target_size = box.x_max - box.x_min + 1;
box_helper::Compute(&elements, target_size);
int x = box.x_min;

View File

@ -39,11 +39,11 @@ Element vscroll_indicator(Element child) {
const Box& stencil = screen.stencil;
int size_inner = box_.y_max - box_.y_min;
const int size_inner = box_.y_max - box_.y_min;
if (size_inner <= 0) {
return;
}
int size_outter = stencil.y_max - stencil.y_min + 1;
const int size_outter = stencil.y_max - stencil.y_min + 1;
if (size_outter >= size_inner) {
return;
}
@ -51,15 +51,16 @@ Element vscroll_indicator(Element child) {
int size = 2 * size_outter * size_outter / size_inner;
size = std::max(size, 1);
int start_y = 2 * stencil.y_min + //
2 * (stencil.y_min - box_.y_min) * size_outter / size_inner;
const int start_y =
2 * stencil.y_min + //
2 * (stencil.y_min - box_.y_min) * size_outter / size_inner;
const int x = stencil.x_max;
for (int y = stencil.y_min; y <= stencil.y_max; ++y) {
int y_up = 2 * y + 0;
int y_down = 2 * y + 1;
bool up = (start_y <= y_up) && (y_up <= start_y + size);
bool down = (start_y <= y_down) && (y_down <= start_y + size);
const int y_up = 2 * y + 0;
const int y_down = 2 * y + 1;
const bool up = (start_y <= y_up) && (y_up <= start_y + size);
const bool down = (start_y <= y_down) && (y_down <= start_y + size);
const char* c = up ? (down ? "" : "") : (down ? "" : " "); // NOLINT
screen.PixelAt(x, y) = Pixel();

View File

@ -58,8 +58,8 @@ class SeparatorAuto : public Node {
}
void Render(Screen& screen) override {
bool is_column = (box_.x_max == box_.x_min);
bool is_line = (box_.y_min == box_.y_max);
const bool is_column = (box_.x_max == box_.x_min);
const bool is_line = (box_.y_min == box_.y_max);
const std::string c = charsets[style_][int(is_line && !is_column)];
@ -414,14 +414,14 @@ Element separatorHSelector(float left,
int demi_cell_left = int(left_ * 2.F - 1.F); // NOLINT
int demi_cell_right = int(right_ * 2.F + 2.F); // NOLINT
int y = box_.y_min;
const int y = box_.y_min;
for (int x = box_.x_min; x <= box_.x_max; ++x) {
Pixel& pixel = screen.PixelAt(x, y);
int a = (x - box_.x_min) * 2;
int b = a + 1;
bool a_empty = demi_cell_left == a || demi_cell_right == a;
bool b_empty = demi_cell_left == b || demi_cell_right == b;
const int a = (x - box_.x_min) * 2;
const int b = a + 1;
const bool a_empty = demi_cell_left == a || demi_cell_right == a;
const bool b_empty = demi_cell_left == b || demi_cell_right == b;
if (!a_empty && !b_empty) {
pixel.character = "";
@ -481,17 +481,17 @@ Element separatorVSelector(float up,
}
// This are the two location with an empty demi-cell.
int demi_cell_up = int(up_ * 2 - 1);
int demi_cell_down = int(down_ * 2 + 2);
const int demi_cell_up = int(up_ * 2 - 1);
const int demi_cell_down = int(down_ * 2 + 2);
int x = box_.x_min;
const int x = box_.x_min;
for (int y = box_.y_min; y <= box_.y_max; ++y) {
Pixel& pixel = screen.PixelAt(x, y);
int a = (y - box_.y_min) * 2;
int b = a + 1;
bool a_empty = demi_cell_up == a || demi_cell_down == a;
bool b_empty = demi_cell_up == b || demi_cell_down == b;
const int a = (y - box_.y_min) * 2;
const int b = a + 1;
const bool a_empty = demi_cell_up == a || demi_cell_down == a;
const bool b_empty = demi_cell_up == b || demi_cell_down == b;
if (!a_empty && !b_empty) {
pixel.character = "";

View File

@ -720,14 +720,14 @@ TEST(TableTest, Merge) {
Screen screen(7, 7);
Render(screen, table.Render());
EXPECT_EQ(
"┌─┲━┱─┐\r\n"
"│a┃b┃c│\r\n"
"┢━╋━╋━┪\r\n"
"┃d┃e┃f┃\r\n"
"┡━╋━╋━┩\r\n"
"│g┃h┃i│\r\n"
"└─┺━┹─┘",
screen.ToString());
"┌─┲━┱─┐\r\n"
"│a┃b┃c│\r\n"
"┢━╋━╋━┪\r\n"
"┃d┃e┃f┃\r\n"
"┡━╋━╋━┩\r\n"
"│g┃h┃i│\r\n"
"└─┺━┹─┘",
screen.ToString());
}
} // namespace ftxui

View File

@ -27,7 +27,7 @@ class Text : public Node {
void Render(Screen& screen) override {
int x = box_.x_min;
int y = box_.y_min;
const int y = box_.y_min;
if (y > box_.y_max) {
return;
}
@ -55,7 +55,7 @@ class VText : public Node {
}
void Render(Screen& screen) override {
int x = box_.x_min;
const int x = box_.x_min;
int y = box_.y_min;
if (x + width_ - 1 > box_.x_max) {
return;

View File

@ -1,8 +1,9 @@
#include <algorithm> // for min
#include <functional> // for function
#include <memory> // for __shared_ptr_access, make_unique
#include <utility> // for move
#include <vector> // for vector
#include <algorithm> // for min
#include <functional> // for function
#include <memory> // for __shared_ptr_access, make_unique
#include <type_traits> // for remove_reference, remove_reference<>::type
#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/node.hpp" // for Node, Node::Status
@ -88,7 +89,7 @@ Element& operator|=(Element& e, Decorator d) {
/// @see Fixed
/// @see Full
Dimensions Dimension::Fit(Element& e) {
Dimensions fullsize = Dimension::Full();
const Dimensions fullsize = Dimension::Full();
Box box;
box.x_min = 0;
box.y_min = 0;

View File

@ -49,7 +49,7 @@ class VBox : public Node {
element.flex_grow = requirement.flex_grow_y;
element.flex_shrink = requirement.flex_shrink_y;
}
int target_size = box.y_max - box.y_min + 1;
const int target_size = box.y_max - box.y_min + 1;
box_helper::Compute(&elements, target_size);
int y = box.y_min;

View File

@ -103,11 +103,11 @@ Color::Color(uint8_t red, uint8_t green, uint8_t blue)
const int database_begin = 16;
const int database_end = 256;
for (int i = database_begin; i < database_end; ++i) {
ColorInfo color_info = GetColorInfo(Color::Palette256(i));
int dr = color_info.red - red;
int dg = color_info.green - green;
int db = color_info.blue - blue;
int dist = dr * dr + dg * dg + db * db;
const ColorInfo color_info = GetColorInfo(Color::Palette256(i));
const int dr = color_info.red - red;
const int dg = color_info.green - green;
const int db = color_info.blue - blue;
const int dist = dr * dr + dg * dg + db * db;
if (closest > dist) {
closest = dist;
best = i;
@ -186,7 +186,7 @@ Color Color::Interpolate(float t, const Color& a, const Color& b) {
}
case ColorType::Palette16: {
ColorInfo info = GetColorInfo(Color::Palette16(color.red_));
const ColorInfo info = GetColorInfo(Color::Palette16(color.red_));
*red = info.red;
*green = info.green;
*blue = info.blue;
@ -194,7 +194,7 @@ Color Color::Interpolate(float t, const Color& a, const Color& b) {
}
case ColorType::Palette256: {
ColorInfo info = GetColorInfo(Color::Palette256(color.red_));
const ColorInfo info = GetColorInfo(Color::Palette256(color.red_));
*red = info.red;
*green = info.green;
*blue = info.blue;

View File

@ -410,7 +410,7 @@ std::string Screen::ToString() {
std::stringstream ss;
Pixel previous_pixel;
Pixel final_pixel;
const Pixel final_pixel;
for (int y = 0; y < dimy_; ++y) {
if (y != 0) {

View File

@ -1,5 +1,6 @@
// Content of this file was created thanks to:
// - https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
// -
// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
// - Markus Kuhn -- 2007-05-26 (Unicode 5.0)
// http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
// Thanks you!
@ -7,9 +8,11 @@
#include "ftxui/screen/string.hpp"
#include <array> // for array
#include <cstdint> // for uint32_t, uint8_t
#include <cstdint> // for uint32_t, uint8_t, uint16_t, int32_t
#include <string> // for string, basic_string, wstring
#include <tuple> // for std::ignore
#include <tuple> // for _Swallow_assign, ignore
#include "ftxui/screen/deprecated.hpp" // for wchar_width, wstring_width
namespace {
@ -1485,7 +1488,7 @@ bool Bisearch(uint32_t ucs, const std::array<Interval, N> table) {
int min = 0;
int max = N - 1;
while (max >= min) {
int mid = (min + max) / 2;
const int mid = (min + max) / 2;
if (ucs > table[mid].last) { // NOLINT
min = mid + 1;
} else if (ucs < table[mid].first) { // NOLINT
@ -1508,7 +1511,7 @@ bool Bisearch(uint32_t ucs, const std::array<C, N> table, C* out) {
int min = 0;
int max = N - 1;
while (max >= min) {
int mid = (min + max) / 2;
const int mid = (min + max) / 2;
if (ucs > table[mid].last) { // NOLINT
min = mid + 1;
} else if (ucs < table[mid].first) { // NOLINT
@ -1574,7 +1577,7 @@ bool EatCodePoint(const std::string& input,
*end = start + 1;
return false;
}
uint8_t C0 = input[start];
const uint8_t C0 = input[start];
// 1 byte string.
if ((C0 & 0b1000'0000) == 0b0000'0000) { // NOLINT
@ -1586,7 +1589,7 @@ bool EatCodePoint(const std::string& input,
// 2 byte string.
if ((C0 & 0b1110'0000) == 0b1100'0000 && // NOLINT
start + 1 < input.size()) {
uint8_t C1 = input[start + 1];
const uint8_t C1 = input[start + 1];
*ucs = 0;
*ucs += C0 & 0b0001'1111; // NOLINT
*ucs <<= 6; // NOLINT
@ -1598,8 +1601,8 @@ bool EatCodePoint(const std::string& input,
// 3 byte string.
if ((C0 & 0b1111'0000) == 0b1110'0000 && // NOLINT
start + 2 < input.size()) {
uint8_t C1 = input[start + 1];
uint8_t C2 = input[start + 2];
const uint8_t C1 = input[start + 1];
const uint8_t C2 = input[start + 2];
*ucs = 0;
*ucs += C0 & 0b0000'1111; // NOLINT
*ucs <<= 6; // NOLINT
@ -1613,9 +1616,9 @@ bool EatCodePoint(const std::string& input,
// 4 byte string.
if ((C0 & 0b1111'1000) == 0b1111'0000 && // NOLINT
start + 3 < input.size()) {
uint8_t C1 = input[start + 1];
uint8_t C2 = input[start + 2];
uint8_t C3 = input[start + 3];
const uint8_t C1 = input[start + 1];
const uint8_t C2 = input[start + 2];
const uint8_t C3 = input[start + 3];
*ucs = 0;
*ucs += C0 & 0b0000'0111; // NOLINT
*ucs <<= 6; // NOLINT
@ -1645,10 +1648,9 @@ bool EatCodePoint(const std::wstring& input,
return false;
}
// On linux wstring uses the UTF32 encoding:
if constexpr (sizeof(wchar_t) == 4) {
*ucs = input[start]; // NOLINT
*ucs = input[start]; // NOLINT
*end = start + 1;
return true;
}
@ -1686,7 +1688,7 @@ int wstring_width(const std::wstring& text) {
int width = 0;
for (const wchar_t& it : text) {
int w = wchar_width(it);
const int w = wchar_width(it);
if (w < 0) {
return -1;
}
@ -1724,7 +1726,7 @@ int string_width(const std::string& input) {
std::vector<std::string> Utf8ToGlyphs(const std::string& input) {
std::vector<std::string> out;
std::string current;
const std::string current;
out.reserve(input.size());
size_t start = 0;
size_t end = 0;
@ -1735,7 +1737,7 @@ std::vector<std::string> Utf8ToGlyphs(const std::string& input) {
continue;
}
std::string append = input.substr(start, end - start);
const std::string append = input.substr(start, end - start);
start = end;
// Ignore control characters.
@ -1772,7 +1774,7 @@ int GlyphPosition(const std::string& input, size_t glyph_index, size_t start) {
size_t end = 0;
while (start < input.size()) {
uint32_t codepoint = 0;
bool eaten = EatCodePoint(input, start, &end, &codepoint);
const bool eaten = EatCodePoint(input, start, &end, &codepoint);
// Ignore invalid, control characters and combining characters.
if (!eaten || IsControl(codepoint) || IsCombining(codepoint)) {
@ -1801,7 +1803,7 @@ std::vector<int> CellToGlyphIndex(const std::string& input) {
size_t end = 0;
while (start < input.size()) {
uint32_t codepoint = 0;
bool eaten = EatCodePoint(input, start, &end, &codepoint);
const bool eaten = EatCodePoint(input, start, &end, &codepoint);
start = end;
// Ignore invalid / control characters.
@ -1840,7 +1842,7 @@ int GlyphCount(const std::string& input) {
size_t end = 0;
while (start < input.size()) {
uint32_t codepoint = 0;
bool eaten = EatCodePoint(input, start, &end, &codepoint);
const bool eaten = EatCodePoint(input, start, &end, &codepoint);
start = end;
// Ignore invalid characters:
@ -1916,7 +1918,7 @@ std::string to_string(const std::wstring& s) {
// 1 byte UTF8
if (codepoint <= 0b000'0000'0111'1111) { // NOLINT
uint8_t p1 = codepoint;
const uint8_t p1 = codepoint;
out.push_back(p1); // NOLINT
continue;
}

View File

@ -134,8 +134,8 @@ TEST(StringTest, Utf8ToWordBreakProperty) {
EXPECT_EQ(Utf8ToWordBreakProperty("'"), T({P::Single_Quote}));
EXPECT_EQ(Utf8ToWordBreakProperty(":"), T({P::MidLetter}));
EXPECT_EQ(Utf8ToWordBreakProperty("."), T({P::MidNumLet}));
EXPECT_EQ(Utf8ToWordBreakProperty("\r"), T({})); // FIXME
EXPECT_EQ(Utf8ToWordBreakProperty("\n"), T({})); // FIXME
EXPECT_EQ(Utf8ToWordBreakProperty("\r"), T({})); // FIXME
EXPECT_EQ(Utf8ToWordBreakProperty("\n"), T({})); // FIXME
}
TEST(StringTest, to_string) {

View File

@ -8,6 +8,6 @@ rm * -rf
echo $CMAKE_CXX_INCLUDE_WHAT_YOU_USE
cmake .. -DFTXUI_BUILD_TESTS=ON -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-Xiwyu;--cxx17ns;-Xiwyu;--mapping_file=${mapping_dir}/iwyu.imp;-Xiwyu;--verbose=3"
make -j 2>out
fix_includes.py --comments < out
fix_include --comments < out
../tools/format.sh