mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-04 13:38:14 +08:00 
			
		
		
		
	Use IWYU.
This commit is contained in:
		@@ -1,7 +1,11 @@
 | 
			
		||||
#include "ftxui/component/button.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
#include <functional>  // for function
 | 
			
		||||
#include <memory>      // for shared_ptr
 | 
			
		||||
 | 
			
		||||
#include <functional>
 | 
			
		||||
#include "ftxui/component/button.hpp"
 | 
			
		||||
#include "ftxui/component/captured_mouse.hpp"  // for CapturedMouse
 | 
			
		||||
#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 ScreenInteractive
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -12,7 +16,7 @@ Element Button::Render() {
 | 
			
		||||
 | 
			
		||||
bool Button::OnEvent(Event event) {
 | 
			
		||||
  if (event.is_mouse() && box_.Contain(event.mouse().x, event.mouse().y)) {
 | 
			
		||||
    if (!event.screen()->CaptureMouse())
 | 
			
		||||
    if (!CaptureMouse(event))
 | 
			
		||||
      return false;
 | 
			
		||||
 | 
			
		||||
    TakeFocus();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,11 @@
 | 
			
		||||
#include "ftxui/component/checkbox.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
#include <functional>  // for function
 | 
			
		||||
#include <memory>      // for shared_ptr
 | 
			
		||||
 | 
			
		||||
#include <functional>
 | 
			
		||||
#include "ftxui/component/captured_mouse.hpp"  // for CapturedMouse
 | 
			
		||||
#include "ftxui/component/checkbox.hpp"
 | 
			
		||||
#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 ScreenInteractive
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -27,7 +31,7 @@ bool CheckBox::OnEvent(Event event) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool CheckBox::OnMouseEvent(Event event) {
 | 
			
		||||
  if (!event.screen()->CaptureMouse())
 | 
			
		||||
    if (!CaptureMouse(event))
 | 
			
		||||
    return false;
 | 
			
		||||
  if (!box_.Contain(event.mouse().x, event.mouse().y))
 | 
			
		||||
    return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,20 @@
 | 
			
		||||
#include "ftxui/component/component.hpp"
 | 
			
		||||
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/component/captured_mouse.hpp"
 | 
			
		||||
#include "ftxui/component/event.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
namespace {
 | 
			
		||||
class CaptureMouseImpl : public CapturedMouseInterface {
 | 
			
		||||
 public:
 | 
			
		||||
  ~CaptureMouseImpl() override {}
 | 
			
		||||
};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Component::~Component() {
 | 
			
		||||
  Detach();
 | 
			
		||||
}
 | 
			
		||||
@@ -97,6 +106,16 @@ void Component::TakeFocus() {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// @brief Take the CapturedMouse if available. There is only one component of
 | 
			
		||||
/// them. It represents a component taking priority over others.
 | 
			
		||||
/// @argument event
 | 
			
		||||
/// @ingroup component
 | 
			
		||||
CapturedMouse Component::CaptureMouse(const Event& event) {
 | 
			
		||||
  if (!event.screen_)
 | 
			
		||||
    return std::make_unique<CaptureMouseImpl>();
 | 
			
		||||
  return event.screen_->CaptureMouse();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// @brief Detach this children from its parent.
 | 
			
		||||
/// @see Attach
 | 
			
		||||
/// @see Detach
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
#include "ftxui/component/container.hpp"
 | 
			
		||||
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,10 @@
 | 
			
		||||
#include "ftxui/component/container.hpp"
 | 
			
		||||
#include <gtest/gtest-message.h>    // for Message
 | 
			
		||||
#include <gtest/gtest-test-part.h>  // for TestPartResult, SuiteApiResolver
 | 
			
		||||
#include <memory>                   // for allocator
 | 
			
		||||
 | 
			
		||||
#include "gtest/gtest.h"
 | 
			
		||||
#include "ftxui/component/container.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"     // for ftxui
 | 
			
		||||
#include "gtest/gtest_pred_impl.h"  // for AssertionResult, EXPECT_EQ, EXPEC...
 | 
			
		||||
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
#include "ftxui/component/event.hpp"
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include "ftxui/component/mouse.hpp"
 | 
			
		||||
#include "ftxui/screen/string.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,11 @@
 | 
			
		||||
#include "ftxui/component/input.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/screen/string.hpp"
 | 
			
		||||
#include "ftxui/component/captured_mouse.hpp"
 | 
			
		||||
#include "ftxui/component/mouse.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -103,7 +105,7 @@ bool Input::OnEvent(Event event) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool Input::OnMouseEvent(Event event) {
 | 
			
		||||
  if (!event.screen()->CaptureMouse())
 | 
			
		||||
  if (!CaptureMouse(event))
 | 
			
		||||
    return false;
 | 
			
		||||
  if (!input_box_.Contain(event.mouse().x, event.mouse().y))
 | 
			
		||||
    return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,13 @@
 | 
			
		||||
#include "ftxui/component/menu.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/component/captured_mouse.hpp"
 | 
			
		||||
#include "ftxui/component/mouse.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -28,7 +33,7 @@ Element Menu::Render() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool Menu::OnEvent(Event event) {
 | 
			
		||||
  if (!event.screen()->CaptureMouse())
 | 
			
		||||
  if (!CaptureMouse(event))
 | 
			
		||||
    return false;
 | 
			
		||||
  if (event.is_mouse())
 | 
			
		||||
    return OnMouseEvent(event);
 | 
			
		||||
@@ -63,7 +68,7 @@ bool Menu::OnEvent(Event event) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool Menu::OnMouseEvent(Event event) {
 | 
			
		||||
  if (!event.screen()->CaptureMouse())
 | 
			
		||||
  if (!CaptureMouse(event))
 | 
			
		||||
    return false;
 | 
			
		||||
  for (int i = 0; i < boxes_.size(); ++i) {
 | 
			
		||||
    if (!boxes_[i].Contain(event.mouse().x, event.mouse().y))
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,14 @@
 | 
			
		||||
#include "ftxui/component/radiobox.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <functional>
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/component/captured_mouse.hpp"
 | 
			
		||||
#include "ftxui/component/mouse.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -13,8 +19,9 @@ Element RadioBox::Render() {
 | 
			
		||||
  for (size_t i = 0; i < entries.size(); ++i) {
 | 
			
		||||
    auto style =
 | 
			
		||||
        (focused == int(i) && is_focused) ? focused_style : unfocused_style;
 | 
			
		||||
    auto focus_management =
 | 
			
		||||
        (focused != int(i)) ? nothing : is_focused ? focus : select;
 | 
			
		||||
    auto focus_management = (focused != int(i)) ? nothing
 | 
			
		||||
                            : is_focused        ? focus
 | 
			
		||||
                                                : select;
 | 
			
		||||
 | 
			
		||||
    const std::wstring& symbol = selected == int(i) ? checked : unchecked;
 | 
			
		||||
    elements.push_back(hbox(text(symbol), text(entries[i]) | style) |
 | 
			
		||||
@@ -24,7 +31,7 @@ Element RadioBox::Render() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool RadioBox::OnEvent(Event event) {
 | 
			
		||||
  if (!event.screen()->CaptureMouse())
 | 
			
		||||
  if (!CaptureMouse(event))
 | 
			
		||||
    return false;
 | 
			
		||||
  if (event.is_mouse())
 | 
			
		||||
    return OnMouseEvent(event);
 | 
			
		||||
@@ -58,7 +65,7 @@ bool RadioBox::OnEvent(Event event) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool RadioBox::OnMouseEvent(Event event) {
 | 
			
		||||
  if (!event.screen()->CaptureMouse())
 | 
			
		||||
  if (!CaptureMouse(event))
 | 
			
		||||
    return false;
 | 
			
		||||
  for (int i = 0; i < boxes_.size(); ++i) {
 | 
			
		||||
    if (!boxes_[i].Contain(event.mouse().x, event.mouse().y))
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,10 @@
 | 
			
		||||
#include "ftxui/component/radiobox.hpp"
 | 
			
		||||
#include <gtest/gtest-message.h>  // for Message
 | 
			
		||||
#include <gtest/gtest-test-part.h>  // for TestPartResult, SuiteApiResolver, TestFactoryImpl
 | 
			
		||||
 | 
			
		||||
#include "gtest/gtest.h"
 | 
			
		||||
#include "ftxui/component/event.hpp"  // for Event, Event::ArrowDown, Event::ArrowUp, Event::Tab, Event::TabReverse
 | 
			
		||||
#include "ftxui/component/mouse.hpp"  // for ftxui
 | 
			
		||||
#include "ftxui/component/radiobox.hpp"
 | 
			
		||||
#include "gtest/gtest_pred_impl.h"  // for EXPECT_EQ, Test, TEST
 | 
			
		||||
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,10 @@
 | 
			
		||||
#include <gtest/gtest-message.h>    // for Message
 | 
			
		||||
#include <gtest/gtest-test-part.h>  // for TestPartResult
 | 
			
		||||
#include <thread>                   // for thread
 | 
			
		||||
#include <utility>                  // for move
 | 
			
		||||
 | 
			
		||||
#include "ftxui/component/receiver.hpp"
 | 
			
		||||
 | 
			
		||||
#include <thread>
 | 
			
		||||
 | 
			
		||||
#include "gtest/gtest.h"
 | 
			
		||||
#include "gtest/gtest_pred_impl.h"  // for AssertionResult, Test, EXPECT_EQ
 | 
			
		||||
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,24 @@
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdio.h>    // for fileno, stdin
 | 
			
		||||
#include <algorithm>  // for copy, max, min
 | 
			
		||||
#include <csignal>    // for signal, SIGINT
 | 
			
		||||
#include <cstdlib>    // for exit, NULL
 | 
			
		||||
#include <iostream>   // for cout, ostream
 | 
			
		||||
#include <stack>      // for stack
 | 
			
		||||
#include <thread>     // for thread
 | 
			
		||||
#include <utility>    // for move
 | 
			
		||||
#include <vector>     // for vector
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <csignal>
 | 
			
		||||
#include <cstdlib>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <stack>
 | 
			
		||||
#include <thread>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/component/captured_mouse.hpp"
 | 
			
		||||
#include "ftxui/component/component.hpp"
 | 
			
		||||
#include "ftxui/component/terminal_input_parser.hpp"
 | 
			
		||||
#include "ftxui/screen/string.hpp"
 | 
			
		||||
#include "ftxui/screen/terminal.hpp"
 | 
			
		||||
#include "ftxui/component/captured_mouse.hpp"         // for CapturedMouse
 | 
			
		||||
#include "ftxui/component/component.hpp"              // for Component
 | 
			
		||||
#include "ftxui/component/event.hpp"                  // for Event
 | 
			
		||||
#include "ftxui/component/mouse.hpp"                  // for Mouse
 | 
			
		||||
#include "ftxui/component/receiver.hpp"               // for ReceiverImpl
 | 
			
		||||
#include "ftxui/component/terminal_input_parser.hpp"  // for TerminalInputPa...
 | 
			
		||||
#include "ftxui/dom/node.hpp"                         // for Node, Render
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"                  // for Requirement
 | 
			
		||||
#include "ftxui/screen/terminal.hpp"                  // for Terminal::Dimen...
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
#define DEFINE_CONSOLEV2_PROPERTIES
 | 
			
		||||
@@ -26,8 +31,9 @@
 | 
			
		||||
#error Must be compiled in UNICODE mode
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
#include <termios.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <sys/select.h>  // for select, FD_ISSET
 | 
			
		||||
#include <termios.h>     // for tcsetattr, tcge...
 | 
			
		||||
#include <unistd.h>      // for STDIN_FILENO, read
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// Quick exit is missing in standard CLang headers
 | 
			
		||||
@@ -48,8 +54,7 @@ constexpr int timeout_milliseconds = 20;
 | 
			
		||||
constexpr int timeout_microseconds = timeout_milliseconds * 1000;
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
 | 
			
		||||
void EventListener(std::atomic<bool>* quit,
 | 
			
		||||
                        Sender<Event> out) {
 | 
			
		||||
void EventListener(std::atomic<bool>* quit, Sender<Event> out) {
 | 
			
		||||
  auto console = GetStdHandle(STD_INPUT_HANDLE);
 | 
			
		||||
  auto parser = TerminalInputParser(out->Clone());
 | 
			
		||||
  while (!*quit) {
 | 
			
		||||
@@ -69,8 +74,7 @@ void EventListener(std::atomic<bool>* quit,
 | 
			
		||||
 | 
			
		||||
    std::vector<INPUT_RECORD> records{number_of_events};
 | 
			
		||||
    DWORD number_of_events_read = 0;
 | 
			
		||||
    ReadConsoleInput(console, records.data(),
 | 
			
		||||
                     (DWORD)records.size(),
 | 
			
		||||
    ReadConsoleInput(console, records.data(), (DWORD)records.size(),
 | 
			
		||||
                     &number_of_events_read);
 | 
			
		||||
    records.resize(number_of_events_read);
 | 
			
		||||
 | 
			
		||||
@@ -106,7 +110,7 @@ void EventListener(std::atomic<bool>* quit, Sender<Event> out) {
 | 
			
		||||
 | 
			
		||||
  char c;
 | 
			
		||||
  while (!*quit) {
 | 
			
		||||
    while(read(STDIN_FILENO, &c, 1), c)
 | 
			
		||||
    while (read(STDIN_FILENO, &c, 1), c)
 | 
			
		||||
      parser.Add(c);
 | 
			
		||||
 | 
			
		||||
    emscripten_sleep(1);
 | 
			
		||||
@@ -115,7 +119,7 @@ void EventListener(std::atomic<bool>* quit, Sender<Event> out) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
#include <sys/time.h>
 | 
			
		||||
#include <sys/time.h>  // for timeval
 | 
			
		||||
 | 
			
		||||
int CheckStdinReady(int usec_timeout) {
 | 
			
		||||
  timeval tv = {0, usec_timeout};
 | 
			
		||||
@@ -219,8 +223,7 @@ void OnResize(int /* signal */) {
 | 
			
		||||
 | 
			
		||||
class CapturedMouseImpl : public CapturedMouseInterface {
 | 
			
		||||
 public:
 | 
			
		||||
  CapturedMouseImpl(std::function<void(void)> callback)
 | 
			
		||||
      : callback_(callback) {}
 | 
			
		||||
  CapturedMouseImpl(std::function<void(void)> callback) : callback_(callback) {}
 | 
			
		||||
  ~CapturedMouseImpl() override { callback_(); }
 | 
			
		||||
 | 
			
		||||
 private:
 | 
			
		||||
@@ -366,7 +369,7 @@ void ScreenInteractive::Loop(Component* component) {
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  enable({
 | 
			
		||||
      //DECMode::kMouseVt200,
 | 
			
		||||
      // DECMode::kMouseVt200,
 | 
			
		||||
      DECMode::kMouseAnyEvent,
 | 
			
		||||
      DECMode::kMouseUtf8,
 | 
			
		||||
      DECMode::kMouseSgrExtMode,
 | 
			
		||||
@@ -406,7 +409,7 @@ void ScreenInteractive::Loop(Component* component) {
 | 
			
		||||
      event.mouse().y -= cursor_y_;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    event.SetScreen(this);
 | 
			
		||||
    event.screen_ = this;
 | 
			
		||||
    component->OnEvent(event);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,18 @@
 | 
			
		||||
#include "ftxui/component/slider.hpp"
 | 
			
		||||
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/component/captured_mouse.hpp"
 | 
			
		||||
#include "ftxui/component/mouse.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
#include "ftxui/screen/color.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
template<class T>
 | 
			
		||||
template <class T>
 | 
			
		||||
class SliderImpl : public Component {
 | 
			
		||||
 public:
 | 
			
		||||
  SliderImpl(std::wstring label, T* value, T min, T max, T increment)
 | 
			
		||||
@@ -55,7 +63,7 @@ class SliderImpl : public Component {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (box_.Contain(event.mouse().x, event.mouse().y) &&
 | 
			
		||||
        event.screen()->CaptureMouse()) {
 | 
			
		||||
        CaptureMouse(event)) {
 | 
			
		||||
      TakeFocus();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -63,7 +71,7 @@ class SliderImpl : public Component {
 | 
			
		||||
        event.mouse().motion == Mouse::Pressed &&
 | 
			
		||||
        gauge_box_.Contain(event.mouse().x, event.mouse().y) &&
 | 
			
		||||
        !captured_mouse_) {
 | 
			
		||||
      captured_mouse_ = event.screen()->CaptureMouse();
 | 
			
		||||
      captured_mouse_ = CaptureMouse(event);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (captured_mouse_) {
 | 
			
		||||
@@ -105,3 +113,7 @@ template ComponentPtr Slider(std::wstring label,
 | 
			
		||||
                             float increment);
 | 
			
		||||
 | 
			
		||||
}  // namespace ftxui
 | 
			
		||||
 | 
			
		||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by the MIT license that can be found in
 | 
			
		||||
// the LICENSE file.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,8 @@
 | 
			
		||||
#include "ftxui/component/terminal_input_parser.hpp"
 | 
			
		||||
 | 
			
		||||
#include <utility>
 | 
			
		||||
#include "ftxui/component/event.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
TerminalInputParser::TerminalInputParser(Sender<Event> out)
 | 
			
		||||
@@ -61,7 +64,6 @@ void TerminalInputParser::Send(TerminalInputParser::Output output) {
 | 
			
		||||
      return;
 | 
			
		||||
  }
 | 
			
		||||
  // NOT_REACHED().
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TerminalInputParser::Output TerminalInputParser::Parse() {
 | 
			
		||||
@@ -227,3 +229,7 @@ TerminalInputParser::Output TerminalInputParser::ParseCursorReporting(
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}  // namespace ftxui
 | 
			
		||||
 | 
			
		||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by the MIT license that can be found in
 | 
			
		||||
// the LICENSE file.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,13 @@
 | 
			
		||||
#ifndef FTXUI_COMPONENT_TERMINAL_INPUT_PARSER
 | 
			
		||||
#define FTXUI_COMPONENT_TERMINAL_INPUT_PARSER
 | 
			
		||||
 | 
			
		||||
#include "ftxui/component/event.hpp"
 | 
			
		||||
#include "ftxui/component/receiver.hpp"
 | 
			
		||||
#include <memory>  // for unique_ptr
 | 
			
		||||
#include <string>  // for string
 | 
			
		||||
#include <vector>  // for vector
 | 
			
		||||
 | 
			
		||||
#include <string>
 | 
			
		||||
#include "ftxui/component/event.hpp"     // IWYU pragma: keep
 | 
			
		||||
#include "ftxui/component/mouse.hpp"     // for Mouse
 | 
			
		||||
#include "ftxui/component/receiver.hpp"  // for SenderImpl
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
#include "ftxui/component/terminal_input_parser.hpp"
 | 
			
		||||
#include "ftxui/component/receiver.hpp"
 | 
			
		||||
#include <gtest/gtest-message.h>    // for Message
 | 
			
		||||
#include <gtest/gtest-test-part.h>  // for TestPartResult
 | 
			
		||||
 | 
			
		||||
#include "gtest/gtest.h"
 | 
			
		||||
#include "ftxui/component/receiver.hpp"  // for MakeReceiver, ReceiverImpl
 | 
			
		||||
#include "ftxui/component/terminal_input_parser.hpp"
 | 
			
		||||
#include "gtest/gtest_pred_impl.h"  // for AssertionResult, Test, Suite...
 | 
			
		||||
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,12 @@
 | 
			
		||||
#include "ftxui/component/toggle.hpp"
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"
 | 
			
		||||
#include <stddef.h>   // for size_t
 | 
			
		||||
#include <algorithm>  // for max, min
 | 
			
		||||
#include <memory>     // for shared_ptr, alloca...
 | 
			
		||||
#include <utility>    // for move
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include "ftxui/component/captured_mouse.hpp"      // for CapturedMouse
 | 
			
		||||
#include "ftxui/component/mouse.hpp"               // for Mouse, Mouse::Left
 | 
			
		||||
#include "ftxui/component/screen_interactive.hpp"  // for ScreenInteractive
 | 
			
		||||
#include "ftxui/component/toggle.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -60,7 +65,7 @@ bool Toggle::OnEvent(Event event) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool Toggle::OnMouseEvent(Event event) {
 | 
			
		||||
  if (!event.screen()->CaptureMouse())
 | 
			
		||||
  if (!CaptureMouse(event))
 | 
			
		||||
    return false;
 | 
			
		||||
  for (int i = 0; i < boxes_.size(); ++i) {
 | 
			
		||||
    if (!boxes_[i].Contain(event.mouse().x, event.mouse().y))
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,10 @@
 | 
			
		||||
#include "ftxui/component/toggle.hpp"
 | 
			
		||||
#include <gtest/gtest-message.h>  // for Message
 | 
			
		||||
#include <gtest/gtest-test-part.h>  // for TestPartResult, SuiteApiResolver, TestFactoryImpl
 | 
			
		||||
 | 
			
		||||
#include "gtest/gtest.h"
 | 
			
		||||
#include "ftxui/component/event.hpp"  // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Return, Event::Tab, Event::TabReverse
 | 
			
		||||
#include "ftxui/component/mouse.hpp"  // for ftxui
 | 
			
		||||
#include "ftxui/component/toggle.hpp"
 | 
			
		||||
#include "gtest/gtest_pred_impl.h"  // for AssertionResult, EXPECT_EQ, Test, EXPECT_TRUE, EXPECT_FALSE, TEST
 | 
			
		||||
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,10 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,10 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,14 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <algorithm>  // for max
 | 
			
		||||
#include <iterator>   // for begin, end
 | 
			
		||||
#include <memory>     // for make_shared, __shared_ptr_access
 | 
			
		||||
#include <utility>    // for move
 | 
			
		||||
#include <vector>     // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"  // for unpack, Element, Decorator, Elements, border, borderWith, window
 | 
			
		||||
#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
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,10 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,10 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
#include "ftxui/screen/color.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,12 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <algorithm>  // for max
 | 
			
		||||
#include <memory>     // for __shared_ptr_access, shared_ptr, make_shared
 | 
			
		||||
#include <utility>    // for move
 | 
			
		||||
#include <vector>     // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"     // for Element, Elements, dbox
 | 
			
		||||
#include "ftxui/dom/node.hpp"         // for Node
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"  // for Requirement
 | 
			
		||||
#include "ftxui/screen/box.hpp"       // for Box
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,10 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,10 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,14 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <algorithm>  // for max, min
 | 
			
		||||
#include <memory>     // for make_shared, shared_ptr, __shared_ptr_access
 | 
			
		||||
#include <utility>    // for move
 | 
			
		||||
#include <vector>     // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/util/autoreset.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"  // for Element, unpack, focus, frame, select, xframe, yframe
 | 
			
		||||
#include "ftxui/dom/node.hpp"  // for Node
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"  // for Requirement, Requirement::FOCUSED, Requirement::SELECTED
 | 
			
		||||
#include "ftxui/screen/box.hpp"      // for Box
 | 
			
		||||
#include "ftxui/screen/screen.hpp"   // for Screen, Screen::Cursor
 | 
			
		||||
#include "ftxui/util/autoreset.hpp"  // for AutoReset
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,9 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,12 @@
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
#include "gtest/gtest.h"
 | 
			
		||||
#include <gtest/gtest-message.h>    // for Message
 | 
			
		||||
#include <gtest/gtest-test-part.h>  // for TestPartResult
 | 
			
		||||
#include <memory>                   // for allocator
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"   // for gauge
 | 
			
		||||
#include "ftxui/dom/node.hpp"       // for Render
 | 
			
		||||
#include "ftxui/screen/box.hpp"     // for ftxui
 | 
			
		||||
#include "ftxui/screen/screen.hpp"  // for Screen
 | 
			
		||||
#include "gtest/gtest_pred_impl.h"  // for Test, SuiteApiResolver, EXPECT_EQ
 | 
			
		||||
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,12 @@
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include <functional>  // for function
 | 
			
		||||
#include <memory>      // for make_shared
 | 
			
		||||
#include <vector>      // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"     // for GraphFunction, Element, graph
 | 
			
		||||
#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 Screen
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,12 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <algorithm>  // for max
 | 
			
		||||
#include <memory>     // for __shared_ptr_access, shared_ptr, make_shared
 | 
			
		||||
#include <utility>    // for move
 | 
			
		||||
#include <vector>     // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"     // for Element, Elements, hbox
 | 
			
		||||
#include "ftxui/dom/node.hpp"         // for Node
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"  // for Requirement
 | 
			
		||||
#include "ftxui/screen/box.hpp"       // for Box
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,13 @@
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
#include "gtest/gtest.h"
 | 
			
		||||
#include <gtest/gtest-message.h>    // for Message
 | 
			
		||||
#include <gtest/gtest-test-part.h>  // for TestPartResult
 | 
			
		||||
#include <string>                   // for allocator, basic_string, string
 | 
			
		||||
#include <vector>                   // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"   // for text, operator|, Element, flex_grow
 | 
			
		||||
#include "ftxui/dom/node.hpp"       // for Render
 | 
			
		||||
#include "ftxui/screen/box.hpp"     // for ftxui
 | 
			
		||||
#include "ftxui/screen/screen.hpp"  // for Screen
 | 
			
		||||
#include "gtest/gtest_pred_impl.h"  // for Test, SuiteApiResolver, EXPECT_EQ
 | 
			
		||||
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,12 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <algorithm>  // for max
 | 
			
		||||
#include <memory>     // for __shared_ptr_access, make_shared, shared_ptr
 | 
			
		||||
#include <utility>    // for move
 | 
			
		||||
#include <vector>     // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"     // for Element, Elements, hflow
 | 
			
		||||
#include "ftxui/dom/node.hpp"         // for Node
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"  // for Requirement
 | 
			
		||||
#include "ftxui/screen/box.hpp"       // for Box
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,10 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,7 @@
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,9 @@
 | 
			
		||||
#include <memory>  // for __shared_ptr_access
 | 
			
		||||
#include <vector>  // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"  // for Requirement
 | 
			
		||||
#include "ftxui/screen/box.hpp"       // for Box
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,12 @@
 | 
			
		||||
#ifndef FTXUI_DOM_NODE_DECORATOR_H_
 | 
			
		||||
#define FTXUI_DOM_NODE_DECORATOR_H_
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include <utility>  // for move
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/node.hpp"  // for Node, Elements
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
struct Box;
 | 
			
		||||
 | 
			
		||||
// Helper class.
 | 
			
		||||
class NodeDecorator : public Node {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#include <sstream>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,11 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <utility>
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,9 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,13 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <stddef.h>   // for size_t
 | 
			
		||||
#include <algorithm>  // for min, max
 | 
			
		||||
#include <memory>     // for make_shared, __shared_ptr_access
 | 
			
		||||
#include <utility>    // for move
 | 
			
		||||
#include <vector>     // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"  // for Constraint, Direction, EQUAL, GREATER_THAN, LESS_THAN, WIDTH, unpack, Decorator, Element, size
 | 
			
		||||
#include "ftxui/dom/node.hpp"      // for Node
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"  // for Requirement
 | 
			
		||||
#include "ftxui/screen/box.hpp"       // for Box
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,9 @@
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,13 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/screen/string.hpp"
 | 
			
		||||
#include <algorithm>  // for max
 | 
			
		||||
#include <memory>     // for make_shared
 | 
			
		||||
#include <string>     // for wstring
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"     // for Element, text, vtext
 | 
			
		||||
#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 Screen
 | 
			
		||||
#include "ftxui/screen/string.hpp"    // for wchar_width, wstring_width
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,12 @@
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
#include "gtest/gtest.h"
 | 
			
		||||
#include <gtest/gtest-message.h>    // for Message
 | 
			
		||||
#include <gtest/gtest-test-part.h>  // for TestPartResult
 | 
			
		||||
#include <memory>                   // for allocator
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"   // for text, Element, operator|, border
 | 
			
		||||
#include "ftxui/screen/box.hpp"     // for ftxui
 | 
			
		||||
#include "ftxui/screen/screen.hpp"  // for Screen
 | 
			
		||||
#include "gtest/gtest_pred_impl.h"  // for Test, SuiteApiResolver, EXPECT_EQ
 | 
			
		||||
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
 | 
			
		||||
TEST(TextTest, ScreenHeightSmaller) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,10 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node_decorator.hpp"
 | 
			
		||||
#include "ftxui/screen/box.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,7 @@
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include <functional>  // for function
 | 
			
		||||
#include <utility>     // for move
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"  // for Decorator, Element, Elements, operator|, nothing
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,12 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <algorithm>  // for max
 | 
			
		||||
#include <memory>     // for __shared_ptr_access, shared_ptr, make_shared
 | 
			
		||||
#include <utility>    // for move
 | 
			
		||||
#include <vector>     // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/dom/elements.hpp"     // for Element, Elements, vbox
 | 
			
		||||
#include "ftxui/dom/node.hpp"         // for Node
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"  // for Requirement
 | 
			
		||||
#include "ftxui/screen/box.hpp"       // for Box
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,14 @@
 | 
			
		||||
#include "ftxui/dom/elements.hpp"
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
#include "gtest/gtest.h"
 | 
			
		||||
#include <gtest/gtest-message.h>    // for Message
 | 
			
		||||
#include <gtest/gtest-test-part.h>  // for TestPartResult
 | 
			
		||||
#include <algorithm>                // for remove
 | 
			
		||||
#include <string>                   // for allocator, basic_string, string
 | 
			
		||||
#include <vector>                   // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/elements.hpp"   // for vtext, operator|, Element, flex_grow
 | 
			
		||||
#include "ftxui/dom/node.hpp"       // for Render
 | 
			
		||||
#include "ftxui/screen/box.hpp"     // for ftxui
 | 
			
		||||
#include "ftxui/screen/screen.hpp"  // for Screen
 | 
			
		||||
#include "gtest/gtest_pred_impl.h"  // for Test, SuiteApiResolver, EXPECT_EQ
 | 
			
		||||
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
using namespace ftxui;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,4 @@
 | 
			
		||||
#include "ftxui/screen/color.hpp"
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/screen/color_info.hpp"
 | 
			
		||||
#include "ftxui/screen/string.hpp"
 | 
			
		||||
#include "ftxui/screen/terminal.hpp"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#include "ftxui/screen/color_info.hpp"
 | 
			
		||||
#include "ftxui/screen/color.hpp"  // for Color, Color::Palette16, Color::Palette256
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,12 @@
 | 
			
		||||
#include <algorithm>  // for min
 | 
			
		||||
#include <iostream>  // for operator<<, basic_ostream, wstringstream, stringstream, flush, cout, ostream
 | 
			
		||||
#include <sstream>   // IWYU pragma: keep
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/node.hpp"         // for Element, Node
 | 
			
		||||
#include "ftxui/dom/requirement.hpp"  // for Requirement
 | 
			
		||||
#include "ftxui/screen/screen.hpp"
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <sstream>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/dom/node.hpp"
 | 
			
		||||
#include "ftxui/screen/string.hpp"
 | 
			
		||||
#include "ftxui/screen/terminal.hpp"
 | 
			
		||||
#include "ftxui/screen/string.hpp"    // for to_string, wchar_width
 | 
			
		||||
#include "ftxui/screen/terminal.hpp"  // for Terminal::Dimensions, Terminal
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
#define WIN32_LEAN_AND_MEAN
 | 
			
		||||
@@ -169,9 +169,9 @@ std::string Screen::ToString() {
 | 
			
		||||
 | 
			
		||||
      auto width = wchar_width(c);
 | 
			
		||||
      if (width <= 0) {
 | 
			
		||||
          // Avoid an infinite loop for non-printable characters
 | 
			
		||||
          c = L' ';
 | 
			
		||||
          width = 1;
 | 
			
		||||
        // Avoid an infinite loop for non-printable characters
 | 
			
		||||
        c = L' ';
 | 
			
		||||
        width = 1;
 | 
			
		||||
      }
 | 
			
		||||
      ss << c;
 | 
			
		||||
      x += width;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,20 +1,17 @@
 | 
			
		||||
#include <cstdlib>  // for getenv
 | 
			
		||||
#include <string>   // for string, allocator
 | 
			
		||||
 | 
			
		||||
#include "ftxui/screen/terminal.hpp"
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
#include <cstdlib>
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
#define WIN32_LEAN_AND_MEAN
 | 
			
		||||
#define NOMINMAX
 | 
			
		||||
#include <Windows.h>
 | 
			
		||||
#else
 | 
			
		||||
#include <sys/ioctl.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <sys/ioctl.h>  // for winsize, ioctl, TIOCGWINSZ
 | 
			
		||||
#include <unistd.h>     // for STDOUT_FILENO
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
Terminal::Dimensions Terminal::Size() {
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@
 | 
			
		||||
 * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <wchar.h>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
#include "ftxui/screen/string.hpp"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user