mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-04 13:38:14 +08:00 
			
		
		
		
	Fix format. Try compile on Windows.
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -11,7 +11,7 @@ class Bold : public NodeDecorator {
 | 
			
		||||
  void Render(Screen& screen) override {
 | 
			
		||||
    for (int y = box_.y_min; y <= box_.y_max; ++y) {
 | 
			
		||||
      for (int x = box_.x_min; x <= box_.x_max; ++x) {
 | 
			
		||||
        screen.PixelAt(x,y).bold = true; 
 | 
			
		||||
        screen.PixelAt(x, y).bold = true;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    Node::Render(screen);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -17,7 +17,7 @@ class Border : public Node {
 | 
			
		||||
      : Node(std::move(children)), charset_pixel(10, pixel) {}
 | 
			
		||||
  ~Border() override {}
 | 
			
		||||
 | 
			
		||||
  std::vector<Pixel> charset_pixel; 
 | 
			
		||||
  std::vector<Pixel> charset_pixel;
 | 
			
		||||
  std::vector<wchar_t> charset;
 | 
			
		||||
 | 
			
		||||
  void ComputeRequirement() override {
 | 
			
		||||
@@ -71,13 +71,13 @@ class Border : public Node {
 | 
			
		||||
    screen.at(box_.x_max, box_.y_min) = charset[1];
 | 
			
		||||
    screen.at(box_.x_min, box_.y_max) = charset[2];
 | 
			
		||||
    screen.at(box_.x_max, box_.y_max) = charset[3];
 | 
			
		||||
    for(float x = box_.x_min + 1; x<box_.x_max; ++x) {
 | 
			
		||||
    for (float x = box_.x_min + 1; x < box_.x_max; ++x) {
 | 
			
		||||
      screen.at(x, box_.y_min) = charset[4];
 | 
			
		||||
      screen.at(x, box_.y_max) = charset[4];
 | 
			
		||||
    }
 | 
			
		||||
    for(float y = box_.y_min + 1; y<box_.y_max; ++y) {
 | 
			
		||||
    for (float y = box_.y_min + 1; y < box_.y_max; ++y) {
 | 
			
		||||
      screen.at(box_.x_min, y) = charset[5];
 | 
			
		||||
      screen.at(box_.x_max,y) = charset[5];
 | 
			
		||||
      screen.at(box_.x_max, y) = charset[5];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Draw title.
 | 
			
		||||
@@ -90,13 +90,13 @@ class Border : public Node {
 | 
			
		||||
    screen.PixelAt(box_.x_max, box_.y_min) = charset_pixel[1];
 | 
			
		||||
    screen.PixelAt(box_.x_min, box_.y_max) = charset_pixel[2];
 | 
			
		||||
    screen.PixelAt(box_.x_max, box_.y_max) = charset_pixel[3];
 | 
			
		||||
    for(float x = box_.x_min + 1; x<box_.x_max; ++x) {
 | 
			
		||||
    for (float x = box_.x_min + 1; x < box_.x_max; ++x) {
 | 
			
		||||
      screen.PixelAt(x, box_.y_min) = charset_pixel[4];
 | 
			
		||||
      screen.PixelAt(x, box_.y_max) = charset_pixel[4];
 | 
			
		||||
    }
 | 
			
		||||
    for(float y = box_.y_min + 1; y<box_.y_max; ++y) {
 | 
			
		||||
    for (float y = box_.y_min + 1; y < box_.y_max; ++y) {
 | 
			
		||||
      screen.PixelAt(box_.x_min, y) = charset_pixel[5];
 | 
			
		||||
      screen.PixelAt(box_.x_max,y) = charset_pixel[5];
 | 
			
		||||
      screen.PixelAt(box_.x_max, y) = charset_pixel[5];
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -47,15 +47,11 @@ std::unique_ptr<Node> bgcolor(Color c, Element child) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Decorator color(Color c) {
 | 
			
		||||
  return [c](Element child) {
 | 
			
		||||
    return color(c, std::move(child));
 | 
			
		||||
  };
 | 
			
		||||
  return [c](Element child) { return color(c, std::move(child)); };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Decorator bgcolor(Color c) {
 | 
			
		||||
  return [c](Element child) {
 | 
			
		||||
    return bgcolor(c, std::move(child));
 | 
			
		||||
  };
 | 
			
		||||
  return [c](Element child) { return bgcolor(c, std::move(child)); };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}  // namespace ftxui
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -19,4 +19,4 @@ std::unique_ptr<Node> align_right(Element child) {
 | 
			
		||||
  return hbox(filler(), std::move(child));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace ftxui
 | 
			
		||||
}  // namespace ftxui
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -15,8 +15,10 @@ class DBox : public Node {
 | 
			
		||||
    requirement_.flex.y = 0;
 | 
			
		||||
    for (auto& child : children) {
 | 
			
		||||
      child->ComputeRequirement();
 | 
			
		||||
      requirement_.min.x = std::max(requirement_.min.x, child->requirement().min.x);
 | 
			
		||||
      requirement_.min.y = std::max(requirement_.min.y, child->requirement().min.y);
 | 
			
		||||
      requirement_.min.x =
 | 
			
		||||
          std::max(requirement_.min.x, child->requirement().min.x);
 | 
			
		||||
      requirement_.min.y =
 | 
			
		||||
          std::max(requirement_.min.y, child->requirement().min.y);
 | 
			
		||||
 | 
			
		||||
      if (requirement_.selection < child->requirement().selection) {
 | 
			
		||||
        requirement_.selection = child->requirement().selection;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -14,7 +14,7 @@ class Dim : public NodeDecorator {
 | 
			
		||||
    Node::Render(screen);
 | 
			
		||||
    for (int y = box_.y_min; y <= box_.y_max; ++y) {
 | 
			
		||||
      for (int x = box_.x_min; x <= box_.x_max; ++x) {
 | 
			
		||||
        screen.PixelAt(x,y).dim = true; 
 | 
			
		||||
        screen.PixelAt(x, y).dim = true;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/util/autoreset.hpp"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -24,10 +24,11 @@ class Gauge : public Node {
 | 
			
		||||
    int x = box_.x_min;
 | 
			
		||||
    while (x < limit_int)
 | 
			
		||||
      screen.at(x++, y) = charset[9];
 | 
			
		||||
    screen.at(x++, y) = charset[int(9*(limit-limit_int))];
 | 
			
		||||
    screen.at(x++, y) = charset[int(9 * (limit - limit_int))];
 | 
			
		||||
    while (x <= box_.x_max)
 | 
			
		||||
      screen.at(x++, y) = charset[0];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 private:
 | 
			
		||||
  float progress_;
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,7 @@
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -13,7 +13,7 @@ class HFlow : public Node {
 | 
			
		||||
    requirement_.min.y = 0;
 | 
			
		||||
    requirement_.flex.x = 1;
 | 
			
		||||
    requirement_.flex.y = 1;
 | 
			
		||||
    for(auto& child : children)
 | 
			
		||||
    for (auto& child : children)
 | 
			
		||||
      child->ComputeRequirement();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -23,7 +23,7 @@ class HFlow : public Node {
 | 
			
		||||
    // The position of the first component.
 | 
			
		||||
    int x = box.x_min;
 | 
			
		||||
    int y = box.y_min;
 | 
			
		||||
    int y_next = y; // The position of next row of elements.
 | 
			
		||||
    int y_next = y;  // The position of next row of elements.
 | 
			
		||||
 | 
			
		||||
    for (auto& child : children) {
 | 
			
		||||
      Requirement requirement = child->requirement();
 | 
			
		||||
@@ -37,7 +37,7 @@ class HFlow : public Node {
 | 
			
		||||
 | 
			
		||||
      // Does the current row big enough to contain the element?
 | 
			
		||||
      if (y + requirement.min.y > box.y_max + 1)
 | 
			
		||||
        break; // No? Ignore the element.
 | 
			
		||||
        break;  // No? Ignore the element.
 | 
			
		||||
 | 
			
		||||
      Box children_box;
 | 
			
		||||
      children_box.x_min = x;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -14,7 +14,7 @@ class Inverted : public NodeDecorator {
 | 
			
		||||
    Node::Render(screen);
 | 
			
		||||
    for (int y = box_.y_min; y <= box_.y_max; ++y) {
 | 
			
		||||
      for (int x = box_.x_min; x <= box_.x_max; ++x) {
 | 
			
		||||
        screen.PixelAt(x,y).inverted = true; 
 | 
			
		||||
        screen.PixelAt(x, y).inverted = true;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ Node::Node(std::vector<std::unique_ptr<Node>> children)
 | 
			
		||||
Node::~Node() {}
 | 
			
		||||
 | 
			
		||||
void Node::ComputeRequirement() {
 | 
			
		||||
  for(auto& child : children)
 | 
			
		||||
  for (auto& child : children)
 | 
			
		||||
    child->ComputeRequirement();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -19,20 +19,20 @@ void Node::SetBox(Box box) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Node::Render(Screen& screen) {
 | 
			
		||||
  for(auto& child : children)
 | 
			
		||||
  for (auto& child : children)
 | 
			
		||||
    child->Render(screen);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Render(Screen& screen, Node* node) {
 | 
			
		||||
  // Step 1: Find what dimension this elements wants to be.
 | 
			
		||||
  node->ComputeRequirement();
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  Box box;
 | 
			
		||||
  box.x_min = 0;
 | 
			
		||||
  box.y_min = 0;
 | 
			
		||||
  box.x_max = screen.dimx() - 1;
 | 
			
		||||
  box.y_max = screen.dimy() - 1;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  // Step 2: Assign a dimension to the element.
 | 
			
		||||
  node->SetBox(box);
 | 
			
		||||
  screen.stencil = box;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
#ifndef FTXUI_DOM_NODE_DECORATOR_H_
 | 
			
		||||
#define FTXUI_DOM_NODE_DECORATOR_H_
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#include <sstream>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
@@ -41,7 +43,7 @@ class Size : public Node {
 | 
			
		||||
    Node::SetBox(box);
 | 
			
		||||
 | 
			
		||||
    if (direction_ == WIDTH) {
 | 
			
		||||
      switch(constraint_) {
 | 
			
		||||
      switch (constraint_) {
 | 
			
		||||
        case LESS_THAN:
 | 
			
		||||
        case EQUAL:
 | 
			
		||||
          box.x_max = std::min(box.x_min + value_ + 1, box.x_max);
 | 
			
		||||
@@ -50,7 +52,7 @@ class Size : public Node {
 | 
			
		||||
          break;
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      switch(constraint_) {
 | 
			
		||||
      switch (constraint_) {
 | 
			
		||||
        case LESS_THAN:
 | 
			
		||||
        case EQUAL:
 | 
			
		||||
          box.y_max = std::min(box.y_min + value_ + 1, box.y_max);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,277 +1,259 @@
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
 | 
			
		||||
static const std::vector<std::vector<std::vector<std::wstring>>> elements = {
 | 
			
		||||
  {
 | 
			
		||||
    {L"Replaced by the gauge"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L".  "},
 | 
			
		||||
    {L".. "},
 | 
			
		||||
    {L"..."},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"|"},
 | 
			
		||||
    {L"/"},
 | 
			
		||||
    {L"-"},
 | 
			
		||||
    {L"\\"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"+"},
 | 
			
		||||
    {L"x"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"|  "},
 | 
			
		||||
    {L"|| "},
 | 
			
		||||
    {L"|||"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"←"},
 | 
			
		||||
    {L"↖"},
 | 
			
		||||
    {L"↑"},
 | 
			
		||||
    {L"↗"},
 | 
			
		||||
    {L"→"},
 | 
			
		||||
    {L"↘"},
 | 
			
		||||
    {L"↓"},
 | 
			
		||||
    {L"↙"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"▁"},
 | 
			
		||||
    {L"▂"},
 | 
			
		||||
    {L"▃"},
 | 
			
		||||
    {L"▄"},
 | 
			
		||||
    {L"▅"},
 | 
			
		||||
    {L"▆"},
 | 
			
		||||
    {L"▇"},
 | 
			
		||||
    {L"█"},
 | 
			
		||||
    {L"▇"},
 | 
			
		||||
    {L"▆"},
 | 
			
		||||
    {L"▅"},
 | 
			
		||||
    {L"▄"},
 | 
			
		||||
    {L"▃"},
 | 
			
		||||
    {L"▁"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"▉"},
 | 
			
		||||
    {L"▊"},
 | 
			
		||||
    {L"▋"},
 | 
			
		||||
    {L"▌"},
 | 
			
		||||
    {L"▍"},
 | 
			
		||||
    {L"▎"},
 | 
			
		||||
    {L"▏"},
 | 
			
		||||
    {L"▎"},
 | 
			
		||||
    {L"▍"},
 | 
			
		||||
    {L"▌"},
 | 
			
		||||
    {L"▋"},
 | 
			
		||||
    {L"▊"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"▖"},
 | 
			
		||||
    {L"▘"},
 | 
			
		||||
    {L"▝"},
 | 
			
		||||
    {L"▗"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"◢"},
 | 
			
		||||
    {L"◣"},
 | 
			
		||||
    {L"◤"},
 | 
			
		||||
    {L"◥"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"◰"},
 | 
			
		||||
    {L"◳"},
 | 
			
		||||
    {L"◲"},
 | 
			
		||||
    {L"◱"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"◴"},
 | 
			
		||||
    {L"◷"},
 | 
			
		||||
    {L"◶"},
 | 
			
		||||
    {L"◵"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"◐"},
 | 
			
		||||
    {L"◓"},
 | 
			
		||||
    {L"◑"},
 | 
			
		||||
    {L"◒"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"◡"},
 | 
			
		||||
    {L"⊙"},
 | 
			
		||||
    {L"◠"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"⠁"},
 | 
			
		||||
    {L"⠂"},
 | 
			
		||||
    {L"⠄"},
 | 
			
		||||
    {L"⡀"},
 | 
			
		||||
    {L"⢀"},
 | 
			
		||||
    {L"⠠"},
 | 
			
		||||
    {L"⠐"},
 | 
			
		||||
    {L"⠈"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"⠋"},
 | 
			
		||||
    {L"⠙"},
 | 
			
		||||
    {L"⠹"},
 | 
			
		||||
    {L"⠸"},
 | 
			
		||||
    {L"⠼"},
 | 
			
		||||
    {L"⠴"},
 | 
			
		||||
    {L"⠦"},
 | 
			
		||||
    {L"⠧"},
 | 
			
		||||
    {L"⠇"},
 | 
			
		||||
    {L"⠏"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"(*----------)"},
 | 
			
		||||
    {L"(-*---------)"},
 | 
			
		||||
    {L"(--*--------)"},
 | 
			
		||||
    {L"(---*-------)"},
 | 
			
		||||
    {L"(----*------)"},
 | 
			
		||||
    {L"(-----*-----)"},
 | 
			
		||||
    {L"(------*----)"},
 | 
			
		||||
    {L"(-------*---)"},
 | 
			
		||||
    {L"(--------*--)"},
 | 
			
		||||
    {L"(---------*-)"},
 | 
			
		||||
    {L"(----------*)"},
 | 
			
		||||
    {L"(---------*-)"},
 | 
			
		||||
    {L"(--------*--)"},
 | 
			
		||||
    {L"(-------*---)"},
 | 
			
		||||
    {L"(------*----)"},
 | 
			
		||||
    {L"(-----*-----)"},
 | 
			
		||||
    {L"(----*------)"},
 | 
			
		||||
    {L"(---*-------)"},
 | 
			
		||||
    {L"(--*--------)"},
 | 
			
		||||
    {L"(-*---------)"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"[      ]"},
 | 
			
		||||
    {L"[=     ]"},
 | 
			
		||||
    {L"[==    ]"},
 | 
			
		||||
    {L"[===   ]"},
 | 
			
		||||
    {L"[====  ]"},
 | 
			
		||||
    {L"[===== ]"},
 | 
			
		||||
    {L"[======]"},
 | 
			
		||||
    {L"[===== ]"},
 | 
			
		||||
    {L"[====  ]"},
 | 
			
		||||
    {L"[===   ]"},
 | 
			
		||||
    {L"[==    ]"},
 | 
			
		||||
    {L"[=     ]"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"[      ]"},
 | 
			
		||||
    {L"[=     ]"},
 | 
			
		||||
    {L"[==    ]"},
 | 
			
		||||
    {L"[===   ]"},
 | 
			
		||||
    {L"[====  ]"},
 | 
			
		||||
    {L"[===== ]"},
 | 
			
		||||
    {L"[======]"},
 | 
			
		||||
    {L"[ =====]"},
 | 
			
		||||
    {L"[  ====]"},
 | 
			
		||||
    {L"[   ===]"},
 | 
			
		||||
    {L"[    ==]"},
 | 
			
		||||
    {L"[     =]"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {L"[==    ]"},
 | 
			
		||||
    {L"[==    ]"},
 | 
			
		||||
    {L"[==    ]"},
 | 
			
		||||
    {L"[==    ]"},
 | 
			
		||||
    {L"[==    ]"},
 | 
			
		||||
    {L" [==   ]"},
 | 
			
		||||
    {L"[  ==  ]"},
 | 
			
		||||
    {L"[   == ]"},
 | 
			
		||||
    {L"[    ==]"},
 | 
			
		||||
    {L"[    ==]"},
 | 
			
		||||
    {L"[    ==]"},
 | 
			
		||||
    {L"[    ==]"},
 | 
			
		||||
    {L"[    ==]"},
 | 
			
		||||
    {L"[   ==] "},
 | 
			
		||||
    {L"[  ==  ]"},
 | 
			
		||||
    {L"[ ==   ]"},
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {
 | 
			
		||||
      L" ─╮",
 | 
			
		||||
      L"  │",
 | 
			
		||||
      L"   ",
 | 
			
		||||
        {L"Replaced by the gauge"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      L"  ╮",
 | 
			
		||||
      L"  │",
 | 
			
		||||
      L"  ╯",
 | 
			
		||||
        {L".  "},
 | 
			
		||||
        {L".. "},
 | 
			
		||||
        {L"..."},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      L"   ",
 | 
			
		||||
      L"  │",
 | 
			
		||||
      L" ─╯",
 | 
			
		||||
        {L"|"},
 | 
			
		||||
        {L"/"},
 | 
			
		||||
        {L"-"},
 | 
			
		||||
        {L"\\"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      L"   ",
 | 
			
		||||
      L"   ",
 | 
			
		||||
      L"╰─╯",
 | 
			
		||||
        {L"+"},
 | 
			
		||||
        {L"x"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      L"   ",
 | 
			
		||||
      L"│  ",
 | 
			
		||||
      L"╰─ ",
 | 
			
		||||
        {L"|  "},
 | 
			
		||||
        {L"|| "},
 | 
			
		||||
        {L"|||"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      L"╭  ",
 | 
			
		||||
      L"│  ",
 | 
			
		||||
      L"╰  ",
 | 
			
		||||
        {L"←"},
 | 
			
		||||
        {L"↖"},
 | 
			
		||||
        {L"↑"},
 | 
			
		||||
        {L"↗"},
 | 
			
		||||
        {L"→"},
 | 
			
		||||
        {L"↘"},
 | 
			
		||||
        {L"↓"},
 | 
			
		||||
        {L"↙"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      L"╭─ ",
 | 
			
		||||
      L"│  ",
 | 
			
		||||
      L"   ",
 | 
			
		||||
        {L"▁"},
 | 
			
		||||
        {L"▂"},
 | 
			
		||||
        {L"▃"},
 | 
			
		||||
        {L"▄"},
 | 
			
		||||
        {L"▅"},
 | 
			
		||||
        {L"▆"},
 | 
			
		||||
        {L"▇"},
 | 
			
		||||
        {L"█"},
 | 
			
		||||
        {L"▇"},
 | 
			
		||||
        {L"▆"},
 | 
			
		||||
        {L"▅"},
 | 
			
		||||
        {L"▄"},
 | 
			
		||||
        {L"▃"},
 | 
			
		||||
        {L"▁"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      L"╭─╮",
 | 
			
		||||
      L"   ",
 | 
			
		||||
      L"   ",
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    {
 | 
			
		||||
      L"   /\\O  ",
 | 
			
		||||
      L"    /\\/ ",
 | 
			
		||||
      L"   /\\   ",
 | 
			
		||||
      L"  /  \\  ",
 | 
			
		||||
      L"LOL  LOL",
 | 
			
		||||
        {L"▉"},
 | 
			
		||||
        {L"▊"},
 | 
			
		||||
        {L"▋"},
 | 
			
		||||
        {L"▌"},
 | 
			
		||||
        {L"▍"},
 | 
			
		||||
        {L"▎"},
 | 
			
		||||
        {L"▏"},
 | 
			
		||||
        {L"▎"},
 | 
			
		||||
        {L"▍"},
 | 
			
		||||
        {L"▌"},
 | 
			
		||||
        {L"▋"},
 | 
			
		||||
        {L"▊"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      L"    _O  ",
 | 
			
		||||
      L"   //|_ ",
 | 
			
		||||
      L"    |   ",
 | 
			
		||||
      L"   /|   ",
 | 
			
		||||
      L"   LLOL ",
 | 
			
		||||
        {L"▖"},
 | 
			
		||||
        {L"▘"},
 | 
			
		||||
        {L"▝"},
 | 
			
		||||
        {L"▗"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      L"     O  ",
 | 
			
		||||
      L"    /_  ",
 | 
			
		||||
      L"    |\\  ",
 | 
			
		||||
      L"   / |  ",
 | 
			
		||||
      L" LOLLOL ",
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
        {L"◢"},
 | 
			
		||||
        {L"◣"},
 | 
			
		||||
        {L"◤"},
 | 
			
		||||
        {L"◥"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        {L"◰"},
 | 
			
		||||
        {L"◳"},
 | 
			
		||||
        {L"◲"},
 | 
			
		||||
        {L"◱"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        {L"◴"},
 | 
			
		||||
        {L"◷"},
 | 
			
		||||
        {L"◶"},
 | 
			
		||||
        {L"◵"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        {L"◐"},
 | 
			
		||||
        {L"◓"},
 | 
			
		||||
        {L"◑"},
 | 
			
		||||
        {L"◒"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        {L"◡"},
 | 
			
		||||
        {L"⊙"},
 | 
			
		||||
        {L"◠"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        {L"⠁"},
 | 
			
		||||
        {L"⠂"},
 | 
			
		||||
        {L"⠄"},
 | 
			
		||||
        {L"⡀"},
 | 
			
		||||
        {L"⢀"},
 | 
			
		||||
        {L"⠠"},
 | 
			
		||||
        {L"⠐"},
 | 
			
		||||
        {L"⠈"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        {L"⠋"},
 | 
			
		||||
        {L"⠙"},
 | 
			
		||||
        {L"⠹"},
 | 
			
		||||
        {L"⠸"},
 | 
			
		||||
        {L"⠼"},
 | 
			
		||||
        {L"⠴"},
 | 
			
		||||
        {L"⠦"},
 | 
			
		||||
        {L"⠧"},
 | 
			
		||||
        {L"⠇"},
 | 
			
		||||
        {L"⠏"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        {L"(*----------)"}, {L"(-*---------)"}, {L"(--*--------)"},
 | 
			
		||||
        {L"(---*-------)"}, {L"(----*------)"}, {L"(-----*-----)"},
 | 
			
		||||
        {L"(------*----)"}, {L"(-------*---)"}, {L"(--------*--)"},
 | 
			
		||||
        {L"(---------*-)"}, {L"(----------*)"}, {L"(---------*-)"},
 | 
			
		||||
        {L"(--------*--)"}, {L"(-------*---)"}, {L"(------*----)"},
 | 
			
		||||
        {L"(-----*-----)"}, {L"(----*------)"}, {L"(---*-------)"},
 | 
			
		||||
        {L"(--*--------)"}, {L"(-*---------)"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        {L"[      ]"},
 | 
			
		||||
        {L"[=     ]"},
 | 
			
		||||
        {L"[==    ]"},
 | 
			
		||||
        {L"[===   ]"},
 | 
			
		||||
        {L"[====  ]"},
 | 
			
		||||
        {L"[===== ]"},
 | 
			
		||||
        {L"[======]"},
 | 
			
		||||
        {L"[===== ]"},
 | 
			
		||||
        {L"[====  ]"},
 | 
			
		||||
        {L"[===   ]"},
 | 
			
		||||
        {L"[==    ]"},
 | 
			
		||||
        {L"[=     ]"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        {L"[      ]"},
 | 
			
		||||
        {L"[=     ]"},
 | 
			
		||||
        {L"[==    ]"},
 | 
			
		||||
        {L"[===   ]"},
 | 
			
		||||
        {L"[====  ]"},
 | 
			
		||||
        {L"[===== ]"},
 | 
			
		||||
        {L"[======]"},
 | 
			
		||||
        {L"[ =====]"},
 | 
			
		||||
        {L"[  ====]"},
 | 
			
		||||
        {L"[   ===]"},
 | 
			
		||||
        {L"[    ==]"},
 | 
			
		||||
        {L"[     =]"},
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        {L"[==    ]"},
 | 
			
		||||
        {L"[==    ]"},
 | 
			
		||||
        {L"[==    ]"},
 | 
			
		||||
        {L"[==    ]"},
 | 
			
		||||
        {L"[==    ]"},
 | 
			
		||||
        {L" [==   ]"},
 | 
			
		||||
        {L"[  ==  ]"},
 | 
			
		||||
        {L"[   == ]"},
 | 
			
		||||
        {L"[    ==]"},
 | 
			
		||||
        {L"[    ==]"},
 | 
			
		||||
        {L"[    ==]"},
 | 
			
		||||
        {L"[    ==]"},
 | 
			
		||||
        {L"[    ==]"},
 | 
			
		||||
        {L"[   ==] "},
 | 
			
		||||
        {L"[  ==  ]"},
 | 
			
		||||
        {L"[ ==   ]"},
 | 
			
		||||
    },
 | 
			
		||||
    {{
 | 
			
		||||
         L" ─╮",
 | 
			
		||||
         L"  │",
 | 
			
		||||
         L"   ",
 | 
			
		||||
     },
 | 
			
		||||
     {
 | 
			
		||||
         L"  ╮",
 | 
			
		||||
         L"  │",
 | 
			
		||||
         L"  ╯",
 | 
			
		||||
     },
 | 
			
		||||
     {
 | 
			
		||||
         L"   ",
 | 
			
		||||
         L"  │",
 | 
			
		||||
         L" ─╯",
 | 
			
		||||
     },
 | 
			
		||||
     {
 | 
			
		||||
         L"   ",
 | 
			
		||||
         L"   ",
 | 
			
		||||
         L"╰─╯",
 | 
			
		||||
     },
 | 
			
		||||
     {
 | 
			
		||||
         L"   ",
 | 
			
		||||
         L"│  ",
 | 
			
		||||
         L"╰─ ",
 | 
			
		||||
     },
 | 
			
		||||
     {
 | 
			
		||||
         L"╭  ",
 | 
			
		||||
         L"│  ",
 | 
			
		||||
         L"╰  ",
 | 
			
		||||
     },
 | 
			
		||||
     {
 | 
			
		||||
         L"╭─ ",
 | 
			
		||||
         L"│  ",
 | 
			
		||||
         L"   ",
 | 
			
		||||
     },
 | 
			
		||||
     {
 | 
			
		||||
         L"╭─╮",
 | 
			
		||||
         L"   ",
 | 
			
		||||
         L"   ",
 | 
			
		||||
     }},
 | 
			
		||||
    {{
 | 
			
		||||
         L"   /\\O  ",
 | 
			
		||||
         L"    /\\/ ",
 | 
			
		||||
         L"   /\\   ",
 | 
			
		||||
         L"  /  \\  ",
 | 
			
		||||
         L"LOL  LOL",
 | 
			
		||||
     },
 | 
			
		||||
     {
 | 
			
		||||
         L"    _O  ",
 | 
			
		||||
         L"   //|_ ",
 | 
			
		||||
         L"    |   ",
 | 
			
		||||
         L"   /|   ",
 | 
			
		||||
         L"   LLOL ",
 | 
			
		||||
     },
 | 
			
		||||
     {
 | 
			
		||||
         L"     O  ",
 | 
			
		||||
         L"    /_  ",
 | 
			
		||||
         L"    |\\  ",
 | 
			
		||||
         L"   / |  ",
 | 
			
		||||
         L" LOLLOL ",
 | 
			
		||||
     }}};
 | 
			
		||||
 | 
			
		||||
std::unique_ptr<Node> spinner(int c, size_t index) {
 | 
			
		||||
  if (c == 0) {
 | 
			
		||||
    index %= 40;
 | 
			
		||||
    if (index > 20)
 | 
			
		||||
      index = 40-index;
 | 
			
		||||
      index = 40 - index;
 | 
			
		||||
    return gauge(index * 0.05);
 | 
			
		||||
  }
 | 
			
		||||
  c %= elements.size();
 | 
			
		||||
  index %= elements[c].size();
 | 
			
		||||
  std::vector<Element> lines;
 | 
			
		||||
  for(const auto& it : elements[c][index])
 | 
			
		||||
  for (const auto& it : elements[c][index])
 | 
			
		||||
    lines.push_back(text(it));
 | 
			
		||||
  return vbox(std::move(lines));
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,10 +7,7 @@ Element nothing(Element element) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Decorator compose(Decorator a, Decorator b) {
 | 
			
		||||
  return [
 | 
			
		||||
    a = std::move(a),
 | 
			
		||||
    b = std::move(b)
 | 
			
		||||
  ](Element element) {
 | 
			
		||||
  return [a = std::move(a), b = std::move(b)](Element element) {
 | 
			
		||||
    return b(a(std::move(element)));
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user