Execute IWYU (#299)

This commit is contained in:
Arthur Sonzogni 2022-01-07 11:03:54 +01:00 committed by GitHub
parent 358f886fab
commit cdd6339849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 242 additions and 248 deletions

View File

@ -1,14 +1,19 @@
#include <stddef.h> // for size_t #include <cmath> // for sin, cos
#include <stdio.h> // for getchar #include <ftxui/dom/elements.hpp> // for canvas, Element, separator, hbox, operator|, border
#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 Pixel
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <memory> // for allocator, shared_ptr #include <string> // for string, basic_string
#include <string> // for operator+, to_string, char_traits, string #include <utility> // for move
#include <vector> // for vector, __alloc_traits<>::value_type
#include "ftxui/component/component.hpp" #include "ftxui/component/component.hpp" // for Renderer, CatchEvent, Horizontal, Menu, Tab
#include "ftxui/component/screen_interactive.hpp" #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/event.hpp" // for Event
#include "ftxui/component/mouse.hpp" // for Mouse
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/canvas.hpp" // for Canvas
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
#include <cmath>
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;
@ -18,7 +23,7 @@ int main(int argc, const char* argv[]) {
// A triangle following the mouse, using braille characters. // A triangle following the mouse, using braille characters.
auto renderer_line_braille = Renderer([&] { auto renderer_line_braille = Renderer([&] {
auto c = Canvas(100, 100); auto c = Canvas(100, 100);
c.DrawText(0,0, "Several lines (braille)"); c.DrawText(0, 0, "Several lines (braille)");
c.DrawPointLine(mouse_x, mouse_y, 80, 10, Color::Red); c.DrawPointLine(mouse_x, mouse_y, 80, 10, Color::Red);
c.DrawPointLine(80, 10, 80, 40, Color::Blue); c.DrawPointLine(80, 10, 80, 40, Color::Blue);
c.DrawPointLine(80, 40, mouse_x, mouse_y, Color::Green); c.DrawPointLine(80, 40, mouse_x, mouse_y, Color::Green);
@ -28,7 +33,7 @@ int main(int argc, const char* argv[]) {
// A triangle following the mouse, using block characters. // A triangle following the mouse, using block characters.
auto renderer_line_block = Renderer([&] { auto renderer_line_block = Renderer([&] {
auto c = Canvas(100, 100); auto c = Canvas(100, 100);
c.DrawText(0,0, "Several lines (block)"); c.DrawText(0, 0, "Several lines (block)");
c.DrawBlockLine(mouse_x, mouse_y, 80, 10, Color::Red); c.DrawBlockLine(mouse_x, mouse_y, 80, 10, Color::Red);
c.DrawBlockLine(80, 10, 80, 40, Color::Blue); c.DrawBlockLine(80, 10, 80, 40, Color::Blue);
c.DrawBlockLine(80, 40, mouse_x, mouse_y, Color::Green); c.DrawBlockLine(80, 40, mouse_x, mouse_y, Color::Green);
@ -38,7 +43,7 @@ int main(int argc, const char* argv[]) {
// A circle following the mouse, using braille characters. // A circle following the mouse, using braille characters.
auto renderer_circle_braille = Renderer([&] { auto renderer_circle_braille = Renderer([&] {
auto c = Canvas(100, 100); auto c = Canvas(100, 100);
c.DrawText(0,0, "A circle (braille)"); c.DrawText(0, 0, "A circle (braille)");
c.DrawPointCircle(mouse_x, mouse_y, 30); c.DrawPointCircle(mouse_x, mouse_y, 30);
return canvas(std::move(c)); return canvas(std::move(c));
}); });
@ -46,7 +51,7 @@ int main(int argc, const char* argv[]) {
// A circle following the mouse, using block characters. // A circle following the mouse, using block characters.
auto renderer_circle_block = Renderer([&] { auto renderer_circle_block = Renderer([&] {
auto c = Canvas(100, 100); auto c = Canvas(100, 100);
c.DrawText(0,0, "A circle (block)"); c.DrawText(0, 0, "A circle (block)");
c.DrawBlockCircle(mouse_x, mouse_y, 30); c.DrawBlockCircle(mouse_x, mouse_y, 30);
return canvas(std::move(c)); return canvas(std::move(c));
}); });
@ -54,7 +59,7 @@ int main(int argc, const char* argv[]) {
// A filled circle following the mouse, using braille characters. // A filled circle following the mouse, using braille characters.
auto renderer_circle_filled_braille = Renderer([&] { auto renderer_circle_filled_braille = Renderer([&] {
auto c = Canvas(100, 100); auto c = Canvas(100, 100);
c.DrawText(0,0, "A circle filled (braille)"); c.DrawText(0, 0, "A circle filled (braille)");
c.DrawPointCircleFilled(mouse_x, mouse_y, 30); c.DrawPointCircleFilled(mouse_x, mouse_y, 30);
return canvas(std::move(c)); return canvas(std::move(c));
}); });
@ -62,7 +67,7 @@ int main(int argc, const char* argv[]) {
// A filled circle following the mouse, using block characters. // A filled circle following the mouse, using block characters.
auto renderer_circle_filled_block = Renderer([&] { auto renderer_circle_filled_block = Renderer([&] {
auto c = Canvas(100, 100); auto c = Canvas(100, 100);
c.DrawText(0,0, "A circle filled (block)"); c.DrawText(0, 0, "A circle filled (block)");
c.DrawBlockCircleFilled(mouse_x, mouse_y, 30); c.DrawBlockCircleFilled(mouse_x, mouse_y, 30);
return canvas(std::move(c)); return canvas(std::move(c));
}); });
@ -70,7 +75,7 @@ int main(int argc, const char* argv[]) {
// An ellipse following the mouse, using braille characters. // An ellipse following the mouse, using braille characters.
auto renderer_ellipse_braille = Renderer([&] { auto renderer_ellipse_braille = Renderer([&] {
auto c = Canvas(100, 100); auto c = Canvas(100, 100);
c.DrawText(0,0, "An ellipse (braille)"); c.DrawText(0, 0, "An ellipse (braille)");
c.DrawPointEllipse(mouse_x / 2, mouse_y / 2, mouse_x / 2, mouse_y / 2); c.DrawPointEllipse(mouse_x / 2, mouse_y / 2, mouse_x / 2, mouse_y / 2);
return canvas(std::move(c)); return canvas(std::move(c));
}); });
@ -78,7 +83,7 @@ int main(int argc, const char* argv[]) {
// An ellipse following the mouse, using block characters. // An ellipse following the mouse, using block characters.
auto renderer_ellipse_block = Renderer([&] { auto renderer_ellipse_block = Renderer([&] {
auto c = Canvas(100, 100); auto c = Canvas(100, 100);
c.DrawText(0,0, "An ellipse (block)"); c.DrawText(0, 0, "An ellipse (block)");
c.DrawBlockEllipse(mouse_x / 2, mouse_y / 2, mouse_x / 2, mouse_y / 2); c.DrawBlockEllipse(mouse_x / 2, mouse_y / 2, mouse_x / 2, mouse_y / 2);
return canvas(std::move(c)); return canvas(std::move(c));
}); });
@ -86,18 +91,18 @@ int main(int argc, const char* argv[]) {
// An ellipse following the mouse filled, using braille characters. // An ellipse following the mouse filled, using braille characters.
auto renderer_ellipse_filled_braille = Renderer([&] { auto renderer_ellipse_filled_braille = Renderer([&] {
auto c = Canvas(100, 100); auto c = Canvas(100, 100);
c.DrawText(0,0, "A filled ellipse (braille)"); c.DrawText(0, 0, "A filled ellipse (braille)");
c.DrawPointEllipseFilled(mouse_x / 2, mouse_y / 2, mouse_x / 2, c.DrawPointEllipseFilled(mouse_x / 2, mouse_y / 2, mouse_x / 2,
mouse_y / 2); mouse_y / 2);
return canvas(std::move(c)); return canvas(std::move(c));
}); });
// An ellipse following the mouse filled, using block characters. // An ellipse following the mouse filled, using block characters.
auto renderer_ellipse_filled_block = Renderer([&] { auto renderer_ellipse_filled_block = Renderer([&] {
auto c = Canvas(100, 100); auto c = Canvas(100, 100);
c.DrawText(0,0, "A filled ellipse (block)"); c.DrawText(0, 0, "A filled ellipse (block)");
c.DrawBlockEllipseFilled(mouse_x / 2, mouse_y / 2, mouse_x / 2, c.DrawBlockEllipseFilled(mouse_x / 2, mouse_y / 2, mouse_x / 2,
mouse_y / 2); mouse_y / 2);
c.DrawBlockEllipse(mouse_x / 2, mouse_y / 2, mouse_x / 2, mouse_y / 2); c.DrawBlockEllipse(mouse_x / 2, mouse_y / 2, mouse_x / 2, mouse_y / 2);
return canvas(std::move(c)); return canvas(std::move(c));
}); });
@ -136,13 +141,13 @@ int main(int argc, const char* argv[]) {
c.DrawText(0, 0, "A symmetrical graph filled"); c.DrawText(0, 0, "A symmetrical graph filled");
std::vector<int> ys(100); std::vector<int> ys(100);
for (int x = 0; x < 100; x++) { for (int x = 0; x < 100; x++) {
ys[x] = 30 + // ys[x] = 30 + //
10 * cos(x * 0.2 - mouse_x * 0.05) + // 10 * cos(x * 0.2 - mouse_x * 0.05) + //
5 * sin(x * 0.4) + // 5 * sin(x * 0.4) + //
5 * sin(x * 0.3 - mouse_y * 0.05); // 5 * sin(x * 0.3 - mouse_y * 0.05); //
} }
for (int x = 0; x < 100; x++) { for (int x = 0; x < 100; x++) {
c.DrawPointLine(x, 50+ys[x], x, 50-ys[x], Color::Red); c.DrawPointLine(x, 50 + ys[x], x, 50 - ys[x], Color::Red);
} }
return canvas(std::move(c)); return canvas(std::move(c));
@ -153,16 +158,16 @@ int main(int argc, const char* argv[]) {
c.DrawText(0, 0, "A 2D gaussian plot"); c.DrawText(0, 0, "A 2D gaussian plot");
int size = 15; int size = 15;
// mouse_x = 5mx + 3*my // mouse_x = 5mx + 3*my
// mouse_y = 0mx + -5my + 90 // mouse_y = 0mx + -5my + 90
float my = (mouse_y - 90) / -5.f; float my = (mouse_y - 90) / -5.f;
float mx = (mouse_x - 3 * my) / 5.f; float mx = (mouse_x - 3 * my) / 5.f;
std::vector<std::vector<float>> ys(size, std::vector<float>(size)); std::vector<std::vector<float>> ys(size, std::vector<float>(size));
for (int y = 0; y < size; y++) { for (int y = 0; y < size; y++) {
for (int x = 0; x < size; x++) { for (int x = 0; x < size; x++) {
float dx = x-mx; float dx = x - mx;
float dy = y-my; float dy = y - my;
ys[y][x] = -1.5 + 3.0 * std::exp(-0.2f * (dx*dx+dy*dy)); ys[y][x] = -1.5 + 3.0 * std::exp(-0.2f * (dx * dx + dy * dy));
} }
} }
for (int y = 0; y < size; y++) { for (int y = 0; y < size; y++) {
@ -183,26 +188,27 @@ int main(int argc, const char* argv[]) {
return canvas(std::move(c)); return canvas(std::move(c));
}); });
int selected_tab = 12; int selected_tab = 12;
auto tab = Container::Tab({ auto tab = Container::Tab(
renderer_line_braille, {
renderer_line_block, renderer_line_braille,
renderer_circle_braille, renderer_line_block,
renderer_circle_block, renderer_circle_braille,
renderer_circle_filled_braille, renderer_circle_block,
renderer_circle_filled_block, renderer_circle_filled_braille,
renderer_ellipse_braille, renderer_circle_filled_block,
renderer_ellipse_block, renderer_ellipse_braille,
renderer_ellipse_filled_braille, renderer_ellipse_block,
renderer_ellipse_filled_block, renderer_ellipse_filled_braille,
renderer_ellipse_filled_block,
renderer_plot_1, renderer_plot_1,
renderer_plot_2, renderer_plot_2,
renderer_plot_3, renderer_plot_3,
renderer_text, renderer_text,
}, &selected_tab); },
&selected_tab);
// This capture the last mouse position. // This capture the last mouse position.
auto tab_with_mouse = CatchEvent(tab, [&](Event e) { auto tab_with_mouse = CatchEvent(tab, [&](Event e) {

View File

@ -1,14 +1,12 @@
#include <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream #include <memory> // for allocator, make_shared, __shared_ptr_access
#include <memory> // for shared_ptr, __shared_ptr_access #include <utility> // for move
#include <string> // for to_string, allocator #include <vector> // for vector
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for MenuEntry, Renderer, Vertical #include "ftxui/component/component.hpp" // for Collapsible, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component_options.hpp" // for MenuEntryOption #include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/dom/elements.hpp" // for text, hbox, Element
#include "ftxui/dom/elements.hpp" // for operator|, separator, Element, Decorator, color, text, hbox, size, bold, frame, inverted, vbox, HEIGHT, LESS_THAN, border
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::Green, Color::Red, Color::Yellow
using namespace ftxui; using namespace ftxui;

View File

@ -1,15 +1,13 @@
#include <stddef.h> // for size_t #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <memory> // for shared_ptr, __shared_ptr_access, allocator #include <string> // for operator+, char_traits, to_string, string
#include <string> // for string, basic_string, to_string, operator+, char_traits
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Radiobox, Vertical, Checkbox, Horizontal, Renderer, ResizableSplitBottom, ResizableSplitRight #include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for text, window, operator|, vbox, hbox, Element, flexbox, bgcolor, filler, flex, size, border, hcenter, color, EQUAL, bold, dim, notflex, xflex_grow, yflex_grow, HEIGHT, WIDTH #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/dom/flexbox_config.hpp" // for FlexboxConfig, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignItems, FlexboxConfig::Direction, FlexboxConfig::JustifyContent::Center, FlexboxConfig::Wrap #include "ftxui/screen/color.hpp" // for Color
#include "ftxui/screen/color.hpp" // for Color, Color::Black
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -3,8 +3,8 @@
#include <iostream> // for endl, cout, ostream #include <iostream> // for endl, cout, ostream
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -1,14 +1,13 @@
#include <stddef.h> // for size_t
#include <stdio.h> // for getchar #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 <cmath> // for cos
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/dom/elements.hpp> // for Fit, canvas, operator|, border, Element
#include <memory> // for allocator, shared_ptr #include <ftxui/screen/screen.hpp> // for Pixel, Screen
#include <string> // for operator+, to_string, char_traits, string #include <vector> // for vector, allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/canvas.hpp" // for Canvas
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
#include <cmath>
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;
@ -32,7 +31,7 @@ int main(int argc, const char* argv[]) {
std::vector<int> ys(100); std::vector<int> ys(100);
for (int x = 0; x < 100; x++) for (int x = 0; x < 100; x++)
ys[x] = 80 + 20 * cos(x * 0.2); ys[x] = 80 + 20 * cos(x * 0.2);
for (int x = 0; x < 99; x++) for (int x = 0; x < 99; x++)
c.DrawPointLine(x, ys[x], x + 1, ys[x + 1], Color::Red); c.DrawPointLine(x, ys[x], x + 1, ys[x + 1], Color::Red);
auto document = canvas(&c) | border; auto document = canvas(&c) | border;

View File

@ -4,9 +4,8 @@
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector, allocator #include <vector> // for vector, allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for Color, Color::Palette256, ftxui
#include "ftxui/screen/color.hpp" // for Color, Color::Palette256
using namespace ftxui; using namespace ftxui;
#include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D #include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D

View File

@ -3,9 +3,8 @@
#include <memory> // for allocator #include <memory> // for allocator
#include <utility> // for move #include <utility> // for move
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for Color, ftxui
#include "ftxui/screen/color.hpp" // for Color
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -3,9 +3,8 @@
#include <memory> // for allocator #include <memory> // for allocator
#include <utility> // for move #include <utility> // for move
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for Color, ftxui
#include "ftxui/screen/color.hpp" // for Color
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -5,8 +5,8 @@
#include <string> // for allocator, operator+, char_traits, operator<<, string, to_string, basic_string #include <string> // for allocator, operator+, char_traits, operator<<, string, to_string, basic_string
#include <thread> // for sleep_for #include <thread> // for sleep_for
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -8,9 +8,8 @@
#include <thread> // for sleep_for #include <thread> // for sleep_for
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for Color, Color::BlueLight, Color::RedLight, Color::YellowLight, ftxui
#include "ftxui/screen/color.hpp" // for Color, Color::BlueLight, Color::RedLight, Color::YellowLight
class Graph { class Graph {
public: public:

View File

@ -3,8 +3,8 @@
#include <ftxui/screen/screen.hpp> // for Screen #include <ftxui/screen/screen.hpp> // for Screen
#include <memory> // for allocator, shared_ptr #include <memory> // for allocator, shared_ptr
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -5,8 +5,8 @@
#include <memory> // for allocator, shared_ptr #include <memory> // for allocator, shared_ptr
#include <string> // for operator+, to_string, char_traits, string #include <string> // for operator+, to_string, char_traits, string
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -9,9 +9,8 @@
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for Color, Color::Green, Color::Red, Color::RedLight, ftxui
#include "ftxui/screen/color.hpp" // for Color, Color::Green, Color::Red, Color::RedLight
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -4,8 +4,8 @@
#include <string> // for string, to_string #include <string> // for string, to_string
#include <utility> // for move #include <utility> // for move
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -7,8 +7,8 @@
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,9 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for Color, Color::Blue, ftxui
#include "ftxui/screen/color.hpp" // for Color, Color::Blue
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -5,9 +5,8 @@
#include <string> // for basic_string, allocator, string #include <string> // for basic_string, allocator, string
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::White, ftxui
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::White
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -3,8 +3,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -5,8 +5,8 @@
#include <memory> // for allocator, shared_ptr #include <memory> // for allocator, shared_ptr
#include <string> // for operator+, to_string, char_traits, string #include <string> // for operator+, to_string, char_traits, string
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,9 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Fixed, Screen #include <ftxui/screen/screen.hpp> // for Fixed, Screen
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for Color, Color::DarkBlue, Color::Green, Color::Red, ftxui
#include "ftxui/screen/color.hpp" // for Color, Color::DarkBlue, Color::Green, Color::Red
int main(void) { int main(void) {
using namespace ftxui; using namespace ftxui;

View File

@ -1,10 +1,13 @@
#ifndef FTXUI_DOM_CANVAS_HPP #ifndef FTXUI_DOM_CANVAS_HPP
#define FTXUI_DOM_CANVAS_HPP #define FTXUI_DOM_CANVAS_HPP
#include "ftxui/screen/color.hpp" #include <stddef.h> // for size_t
#include "ftxui/screen/screen.hpp" #include <functional> // for function
#include <unordered_map> #include <string> // for string
#include <functional> #include <unordered_map> // for unordered_map
#include "ftxui/screen/color.hpp" // for Color
#include "ftxui/screen/screen.hpp" // for Pixel
namespace ftxui { namespace ftxui {
@ -34,25 +37,14 @@ struct Canvas {
void DrawPointCircle(int x, int y, int radius, const Stylizer& s); void DrawPointCircle(int x, int y, int radius, const Stylizer& s);
void DrawPointCircle(int x, int y, int radius, const Color& color); void DrawPointCircle(int x, int y, int radius, const Color& color);
void DrawPointCircleFilled(int x, int y, int radius); void DrawPointCircleFilled(int x, int y, int radius);
void DrawPointCircleFilled(int x, void DrawPointCircleFilled(int x, int y, int radius, const Stylizer& s);
int y,
int radius,
const Stylizer& s);
void DrawPointCircleFilled(int x, int y, int radius, const Color& color); void DrawPointCircleFilled(int x, int y, int radius, const Color& color);
void DrawPointEllipse(int x, int y, int r1, int r2); void DrawPointEllipse(int x, int y, int r1, int r2);
void DrawPointEllipse(int x, int y, int r1, int r2, const Color& color); void DrawPointEllipse(int x, int y, int r1, int r2, const Color& color);
void DrawPointEllipse(int x, int y, int r1, int r2, const Stylizer& s); void DrawPointEllipse(int x, int y, int r1, int r2, const Stylizer& s);
void DrawPointEllipseFilled(int x, int y, int r1, int r2); void DrawPointEllipseFilled(int x, int y, int r1, int r2);
void DrawPointEllipseFilled(int x, void DrawPointEllipseFilled(int x, int y, int r1, int r2, const Color& color);
int y, void DrawPointEllipseFilled(int x, int y, int r1, int r2, const Stylizer& s);
int r1,
int r2,
const Color& color);
void DrawPointEllipseFilled(int x,
int y,
int r1,
int r2,
const Stylizer& s);
// Draw using box characters ------------------------------------------------- // Draw using box characters -------------------------------------------------
// Block are of size 1x2. y is considered to be a multiple of 2. // Block are of size 1x2. y is considered to be a multiple of 2.
@ -76,15 +68,15 @@ struct Canvas {
void DrawBlockEllipse(int x1, int y1, int r1, int r2, const Color& color); void DrawBlockEllipse(int x1, int y1, int r1, int r2, const Color& color);
void DrawBlockEllipseFilled(int x1, int y1, int r1, int r2); void DrawBlockEllipseFilled(int x1, int y1, int r1, int r2);
void DrawBlockEllipseFilled(int x1, void DrawBlockEllipseFilled(int x1,
int y1, int y1,
int r1, int r1,
int r2, int r2,
const Stylizer& s); const Stylizer& s);
void DrawBlockEllipseFilled(int x1, void DrawBlockEllipseFilled(int x1,
int y1, int y1,
int r1, int r1,
int r2, int r2,
const Color& color); const Color& color);
// Draw using normal characters ---------------------------------------------- // Draw using normal characters ----------------------------------------------
// Draw using character of size 2x4 at position (x,y) // Draw using character of size 2x4 at position (x,y)
@ -92,10 +84,7 @@ struct Canvas {
// y is considered to be a multiple of 4. // y is considered to be a multiple of 4.
void DrawText(int x, int y, const std::string& value); void DrawText(int x, int y, const std::string& value);
void DrawText(int x, int y, const std::string& value, const Color& color); void DrawText(int x, int y, const std::string& value, const Color& color);
void DrawText(int x, void DrawText(int x, int y, const std::string& value, const Stylizer& style);
int y,
const std::string& value,
const Stylizer& style);
// Decorator: // Decorator:
// x is considered to be a multiple of 2. // x is considered to be a multiple of 2.
@ -124,7 +113,9 @@ struct Canvas {
}; };
struct XYHash { struct XYHash {
size_t operator()(const XY& xy) const { return static_cast<size_t>(xy.x * 1024 + xy.y); } size_t operator()(const XY& xy) const {
return static_cast<size_t>(xy.x * 1024 + xy.y);
}
}; };
int width_ = 0; int width_ = 0;
@ -134,4 +125,8 @@ struct Canvas {
} // namespace ftxui } // namespace ftxui
#endif // FTXUI_DOM_CANVAS_HPP #endif // FTXUI_DOM_CANVAS_HPP
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,8 +1,9 @@
#ifndef FTXUI_SCREEN_STRING_HPP #ifndef FTXUI_SCREEN_STRING_HPP
#define FTXUI_SCREEN_STRING_HPP #define FTXUI_SCREEN_STRING_HPP
#include <string> // for string, wstring, to_string #include <stddef.h> // for size_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);

View File

@ -1,11 +1,10 @@
#include <memory> // for make_unique, __shared_ptr_access, __shared_ptr_access<>::element_type, shared_ptr #include <string> // for string
#include <utility> // for move #include <utility> // for move
#include "ftxui/component/component.hpp" // for Make, Collapsible #include "ftxui/component/component.hpp" // for Checkbox, Maybe, Make, Vertical, Collapsible
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for Component, ComponentBase
#include "ftxui/component/event.hpp" // for Event #include "ftxui/component/component_options.hpp" // for CheckboxOption
#include "ftxui/dom/elements.hpp" // for Element #include "ftxui/util/ref.hpp" // for Ref, ConstStringRef
#include "ftxui/dom/node.hpp" // for Node
namespace ftxui { namespace ftxui {
@ -14,7 +13,7 @@ namespace ftxui {
/// @params label The label of the checkbox. /// @params label The label of the checkbox.
/// @params child The children to display. /// @params child The children to display.
/// @params show Hold the state about whether the children is displayed or not. /// @params show Hold the state about whether the children is displayed or not.
/// ///
/// ### Example /// ### Example
/// ```cpp /// ```cpp
/// auto component = Collapsible("Show details", details); /// auto component = Collapsible("Show details", details);
@ -22,24 +21,22 @@ namespace ftxui {
/// ///
/// ### Output /// ### Output
/// ``` /// ```
/// ///
/// ▼ Show details /// ▼ Show details
/// <details component> /// <details component>
/// ``` /// ```
Component Collapsible(ConstStringRef label, Component Collapsible(ConstStringRef label, Component child, Ref<bool> show) {
Component child,
Ref<bool> show) {
class Impl : public ComponentBase { class Impl : public ComponentBase {
public: public:
Impl(ConstStringRef label, Component child, Ref<bool> show) Impl(ConstStringRef label, Component child, Ref<bool> show)
: label_(label), show_(std::move(show)) { : label_(label), show_(std::move(show)) {
CheckboxOption opt; CheckboxOption opt;
opt.style_checked = ""; opt.style_checked = "";
opt.style_unchecked = ""; opt.style_unchecked = "";
Add(Container::Vertical({ Add(Container::Vertical({
Checkbox(label_, show_.operator->(), opt), Checkbox(label_, show_.operator->(), opt),
Maybe(std::move(child), show_.operator->()), Maybe(std::move(child), show_.operator->()),
})); }));
} }
ConstStringRef label_; ConstStringRef label_;
Ref<bool> show_; Ref<bool> show_;

View File

@ -1,8 +1,10 @@
#include <algorithm> // for max, min #include <stddef.h> // for size_t
#include <algorithm> // for clamp, max, min
#include <functional> // for function #include <functional> // for function
#include <memory> // for shared_ptr, allocator #include <memory> // for shared_ptr, allocator
#include <string> // for wstring, basic_string #include <string> // for string, wstring
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse #include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/component.hpp" // for Make, Input #include "ftxui/component/component.hpp" // for Make, Input
@ -12,11 +14,10 @@
#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::ArrowRight, 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/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Pressed
#include "ftxui/component/screen_interactive.hpp" // for Component #include "ftxui/component/screen_interactive.hpp" // for Component
#include "ftxui/dom/deprecated.hpp" // for text #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|, Element, reflect, text, dim, flex, focus, inverted, hbox, size, frame, select, underlined, Decorator, EQUAL, HEIGHT
#include "ftxui/screen/box.hpp" // for Box #include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/string.hpp" // for to_wstring, to_string #include "ftxui/screen/string.hpp" // for GlyphPosition, GlyphCount, to_string, CellToGlyphIndex, to_wstring
#include "ftxui/util/ref.hpp" // for WideStringRef, Ref, ConstStringRef, StringRef #include "ftxui/util/ref.hpp" // for StringRef, Ref, WideStringRef, ConstStringRef
namespace ftxui { namespace ftxui {

View File

@ -8,11 +8,12 @@
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for ComponentBase, Component
#include "ftxui/component/component_options.hpp" // for InputOption #include "ftxui/component/component_options.hpp" // for InputOption
#include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Backspace, Event::Delete, Event::End, Event::Home #include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Backspace, Event::Delete, Event::End, Event::Home
#include "ftxui/dom/elements.hpp" // for Fit #include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Button, Mouse::Left, Mouse::Motion, Mouse::Pressed
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/elements.hpp" // for Fit
#include "ftxui/screen/screen.hpp" // for Screen, Pixel #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/util/ref.hpp" // for Ref #include "ftxui/screen/screen.hpp" // for Fixed, Screen, Pixel
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "ftxui/util/ref.hpp" // for Ref
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
using namespace ftxui; using namespace ftxui;

View File

@ -1,9 +1,9 @@
#include <benchmark/benchmark.h> #include <benchmark/benchmark.h>
#include "ftxui/dom/elements.hpp" // for separator, gauge, operator|, text, Element, blink, inverted, hbox, vbox, border #include "ftxui/dom/elements.hpp" // for separator, gauge, operator|, text, Element, blink, inverted, hbox, vbox, border
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
using namespace ftxui; using namespace ftxui;

View File

@ -1,9 +1,20 @@
#include "ftxui/dom/canvas.hpp" #include "ftxui/dom/canvas.hpp"
#include <map> #include <stdlib.h> // for abs
#include <algorithm> // for max, min
#include <cstdint> // for uint8_t
#include <map> // for allocator, map
#include <memory> // for make_shared
#include <utility> // for move, pair
#include <vector> // for vector
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp" // for Element, canvas
#include "ftxui/screen/screen.hpp" #include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/screen.hpp" // for Pixel, Screen
#include "ftxui/screen/string.hpp" // for Utf8ToGlyphs
#include "ftxui/util/ref.hpp" // for ConstRef
namespace ftxui { namespace ftxui {
@ -233,10 +244,7 @@ void Canvas::DrawPointCircle(int x, int y, int radius, const Color& color) {
/// @param y the y coordinate of the center of the circle. /// @param y the y coordinate of the center of the circle.
/// @param radius the radius of the circle. /// @param radius the radius of the circle.
/// @param style the style of the circle. /// @param style the style of the circle.
void Canvas::DrawPointCircle(int x, void Canvas::DrawPointCircle(int x, int y, int radius, const Stylizer& style) {
int y,
int radius,
const Stylizer& style) {
DrawPointEllipse(x, y, radius, radius, style); DrawPointEllipse(x, y, radius, radius, style);
} }
@ -573,10 +581,7 @@ void Canvas::DrawBlockCircle(int x, int y, int radius, const Color& color) {
/// @param y the y coordinate of the center of the circle. /// @param y the y coordinate of the center of the circle.
/// @param radius the radius of the circle. /// @param radius the radius of the circle.
/// @param style the style of the circle. /// @param style the style of the circle.
void Canvas::DrawBlockCircle(int x, void Canvas::DrawBlockCircle(int x, int y, int radius, const Stylizer& style) {
int y,
int radius,
const Stylizer& style) {
DrawBlockEllipse(x, y, radius, radius, style); DrawBlockEllipse(x, y, radius, radius, style);
} }
@ -782,7 +787,7 @@ void Canvas::DrawText(int x,
cell.type = CellType::kText; cell.type = CellType::kText;
cell.content.character = it; cell.content.character = it;
style(cell.content); style(cell.content);
x+=2; x += 2;
} }
} }
@ -868,3 +873,7 @@ Element canvas(std::function<void(Canvas&)> fn) {
} }
} // namespace ftxui } // namespace ftxui
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -3,8 +3,9 @@
#include <string> // for allocator #include <string> // for allocator
#include "ftxui/dom/elements.hpp" // for text, flexbox #include "ftxui/dom/elements.hpp" // for text, flexbox
#include "ftxui/dom/flexbox_config.hpp" // for FlexboxConfig, FlexboxConfig::Direction, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::Direction::Column, FlexboxConfig::AlignItems, FlexboxConfig::JustifyContent::SpaceAround, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignContent::FlexEnd, FlexboxConfig::AlignContent::SpaceAround, FlexboxConfig::AlignContent::SpaceBetween, FlexboxConfig::AlignContent::SpaceEvenly, FlexboxConfig::AlignItems::Center, FlexboxConfig::AlignItems::FlexEnd, FlexboxConfig::Direction::ColumnInversed, FlexboxConfig::Direction::Row, FlexboxConfig::Direction::RowInversed, FlexboxConfig::JustifyContent::Center, FlexboxConfig::JustifyContent::SpaceBetween, ftxui #include "ftxui/dom/flexbox_config.hpp" // for FlexboxConfig, FlexboxConfig::Direction, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::Direction::Column, FlexboxConfig::AlignItems, FlexboxConfig::JustifyContent::SpaceAround, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignContent::FlexEnd, FlexboxConfig::AlignContent::SpaceAround, FlexboxConfig::AlignContent::SpaceBetween, FlexboxConfig::AlignContent::SpaceEvenly, FlexboxConfig::AlignItems::Center, FlexboxConfig::AlignItems::FlexEnd, FlexboxConfig::Direction::ColumnInversed, FlexboxConfig::Direction::Row, FlexboxConfig::Direction::RowInversed, FlexboxConfig::JustifyContent::Center, FlexboxConfig::JustifyContent::SpaceBetween
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST

View File

@ -1,22 +1,17 @@
#include <memory> // for make_shared #include <memory> // for make_shared
#include <utility> // for move #include <utility> // for move
#include "ftxui/dom/elements.hpp" // for Element, bold #include "ftxui/dom/elements.hpp" // for Decorator, Element, focusPosition, focusPositionRelative
#include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/node_decorator.hpp" // for NodeDecorator #include "ftxui/dom/node_decorator.hpp" // for NodeDecorator
#include "ftxui/screen/box.hpp" // for Box #include "ftxui/dom/requirement.hpp" // for Requirement, Requirement::NORMAL, Requirement::Selection
#include "ftxui/screen/screen.hpp" // for Pixel, Screen #include "ftxui/screen/box.hpp" // for Box
namespace ftxui { namespace ftxui {
namespace {
} // namespace
/// @brief Used inside a `frame`, this force the view to be scrolled toward a /// @brief Used inside a `frame`, this force the view to be scrolled toward a
/// a given position. The position is expressed in proportion of the requested /// a given position. The position is expressed in proportion of the requested
/// size. /// size.
/// ///
/// For instance: /// For instance:
/// - (0, 0) means that the view is scrolled toward the upper left. /// - (0, 0) means that the view is scrolled toward the upper left.
/// - (1, 0) means that the view is scrolled toward the upper right. /// - (1, 0) means that the view is scrolled toward the upper right.
@ -59,7 +54,7 @@ Decorator focusPositionRelative(float x, float y) {
/// @brief Used inside a `frame`, this force the view to be scrolled toward a /// @brief Used inside a `frame`, this force the view to be scrolled toward a
/// a given position. The position is expressed in the numbers of cells. /// a given position. The position is expressed in the numbers of cells.
/// ///
/// @ingroup dom /// @ingroup dom
/// ///
/// ### Example /// ### Example

View File

@ -2,11 +2,11 @@
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult #include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/elements.hpp" // for gauge #include "ftxui/dom/elements.hpp" // for gauge
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
using namespace ftxui; using namespace ftxui;
using namespace ftxui; using namespace ftxui;

View File

@ -4,11 +4,11 @@
#include <string> // for allocator, basic_string, string #include <string> // for allocator, basic_string, string
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for text, operator|, Element, flex, flex_grow, Elements, flex_shrink, vtext, gridbox, vbox, border #include "ftxui/dom/elements.hpp" // for text, operator|, Element, flex, Elements, flex_grow, flex_shrink, vtext, gridbox, vbox, border
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, TEST, EXPECT_EQ #include "gtest/gtest_pred_impl.h" // for Test, TEST, EXPECT_EQ
using namespace ftxui; using namespace ftxui;

View File

@ -4,10 +4,10 @@
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for text, operator|, Element, flex_grow, flex_shrink, hbox #include "ftxui/dom/elements.hpp" // for text, operator|, Element, flex_grow, flex_shrink, hbox
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
using namespace ftxui; using namespace ftxui;
using namespace ftxui; using namespace ftxui;

View File

@ -3,9 +3,9 @@
#include <memory> // for allocator #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/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/table.hpp" #include "ftxui/dom/table.hpp"
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST

View File

@ -2,11 +2,11 @@
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult #include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
#include <string> // for allocator, string #include <string> // for allocator, string
#include "ftxui/dom/elements.hpp" // for text, operator|, border, Element #include "ftxui/dom/elements.hpp" // for text, operator|, border, Element
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
using namespace ftxui; using namespace ftxui;

View File

@ -5,10 +5,10 @@
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for vtext, operator|, Element, flex_grow, flex_shrink, vbox #include "ftxui/dom/elements.hpp" // for vtext, operator|, Element, flex_grow, flex_shrink, vbox
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
using namespace ftxui; using namespace ftxui;

View File

@ -288,7 +288,9 @@ std::vector<std::string> Utf8ToGlyphs(const std::string& input) {
return out; return out;
} }
int GlyphPosition(const std::string& input, size_t glyph_to_skip, size_t start) { int GlyphPosition(const std::string& input,
size_t glyph_to_skip,
size_t start) {
if (glyph_to_skip <= 0) if (glyph_to_skip <= 0)
return 0; return 0;
size_t end = 0; size_t end = 0;

View File

@ -59,7 +59,6 @@ TEST(StringTest, GlyphCount) {
EXPECT_EQ(GlyphCount("a\1a"), 2); EXPECT_EQ(GlyphCount("a\1a"), 2);
} }
TEST(StringTest, GlyphPosition) { TEST(StringTest, GlyphPosition) {
// Basic: // Basic:
EXPECT_EQ(GlyphPosition("", -1), 0); EXPECT_EQ(GlyphPosition("", -1), 0);

View File

@ -23,7 +23,7 @@ namespace ftxui {
// https://arthursonzogni.com/FTXUI/examples // https://arthursonzogni.com/FTXUI/examples
// This will have to be improved when someone has time to implement and need // This will have to be improved when someone has time to implement and need
// it. // it.
static Dimensions fallback_size {140, 43}; static Dimensions fallback_size{140, 43};
Dimensions Terminal::Size() { Dimensions Terminal::Size() {
return fallback_size; return fallback_size;
} }
@ -33,7 +33,7 @@ Dimensions Terminal::Size() {
// The terminal size in VT100 was 80x24. It is still used nowadays by // The terminal size in VT100 was 80x24. It is still used nowadays by
// default in many terminal emulator. That's a good choice for a fallback // default in many terminal emulator. That's a good choice for a fallback
// value. // value.
static Dimensions fallback_size {80, 24}; static Dimensions fallback_size{80, 24};
Dimensions Terminal::Size() { Dimensions Terminal::Size() {
CONSOLE_SCREEN_BUFFER_INFO csbi; CONSOLE_SCREEN_BUFFER_INFO csbi;
@ -49,7 +49,7 @@ Dimensions Terminal::Size() {
// The terminal size in VT100 was 80x24. It is still used nowadays by // The terminal size in VT100 was 80x24. It is still used nowadays by
// default in many terminal emulator. That's a good choice for a fallback // default in many terminal emulator. That's a good choice for a fallback
// value. // value.
static Dimensions fallback_size {80, 24}; static Dimensions fallback_size{80, 24};
Dimensions Terminal::Size() { Dimensions Terminal::Size() {
winsize w{}; winsize w{};
const int status = ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); const int status = ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);