Fix format. Try compile on Windows.

This commit is contained in:
ArthurSonzogni
2020-03-22 22:32:44 +01:00
parent 4ff45ee540
commit a402cb4fbb
67 changed files with 615 additions and 569 deletions

View File

@@ -1,4 +1,5 @@
#include "ftxui/component/checkbox.hpp"
#include <functional>
namespace ftxui {
@@ -17,7 +18,7 @@ bool CheckBox::OnEvent(Event event) {
on_change();
return true;
}
return false;
return false;
}
} // namespace ftxui

View File

@@ -1,11 +1,16 @@
#include "ftxui/component/component.hpp"
#include <assert.h>
#include <algorithm>
namespace ftxui {
void Component::Detach() { if (!parent_) return; auto it = std::find(std::begin(parent_->children_),
void Component::Detach() {
if (!parent_)
return;
auto it = std::find(std::begin(parent_->children_),
std::end(parent_->children_), this);
parent_->children_.erase(it);
}
void Component::Attach(Component* parent) {
@@ -23,7 +28,7 @@ Component::~Component() {
}
bool Component::OnEvent(Event event) {
for(Component* child : children_) {
for (Component* child : children_) {
if (child->OnEvent(event))
return true;
}
@@ -43,7 +48,7 @@ Element Component::Render() {
bool Component::Focused() {
Component* current = this;
for(;;) {
for (;;) {
Component* parent = current->parent_;
if (!parent)
return true;

View File

@@ -1,5 +1,7 @@
#include "ftxui/component/container.hpp"
#include <algorithm>
namespace ftxui {
// static

View File

@@ -1,5 +1,7 @@
#include <iostream>
#include "ftxui/component/event.hpp"
#include <iostream>
#include "ftxui/screen/string.hpp"
namespace ftxui {
@@ -49,7 +51,7 @@ Event ParseCSI(std::function<char()> getchar, std::string& input) {
char c = getchar();
input += c;
if (c >= '0' && c<= '9')
if (c >= '0' && c <= '9')
continue;
if (c == ';')
@@ -93,9 +95,12 @@ Event ParseOSC(std::function<char()> getchar, std::string& input) {
Event ParseESC(std::function<char()> getchar, std::string& input) {
input += getchar();
switch (input.back()) {
case 'P': return ParseDCS(getchar, input);
case '[': return ParseCSI(getchar, input);
case ']': return ParseOSC(getchar, input);
case 'P':
return ParseDCS(getchar, input);
case '[':
return ParseCSI(getchar, input);
case ']':
return ParseOSC(getchar, input);
default:
input += getchar();
return Event::Special(input);

View File

@@ -1,5 +1,6 @@
#include "ftxui/component/input.hpp"
#include "ftxui/screen/string.hpp"
#include <algorithm>
namespace ftxui {
@@ -31,13 +32,14 @@ Element Input::Render() {
auto focused =
is_focused ? focus : select;
// clang-format off
return
hbox(
text(part_before_cursor),
text(part_at_cursor) | underlined | focused,
text(part_after_cursor)
) | flex | inverted | frame | main_decorator;
// clang-format off
}
bool Input::OnEvent(Event event) {
cursor_position = std::max(0, std::min<int>(content.size(), cursor_position));

View File

@@ -1,6 +1,7 @@
#include "ftxui/component/menu.hpp"
#include <algorithm>
#include <iostream>
#include <algorithm>
namespace ftxui {

View File

@@ -1,5 +1,6 @@
#include "ftxui/component/radiobox.hpp"
#include <functional>
#include <algorithm>
namespace ftxui {

View File

@@ -10,6 +10,7 @@
#include "ftxui/component/component.hpp"
#include "ftxui/screen/string.hpp"
#include "ftxui/screen/terminal.hpp"
#include <algorithm>
#if defined(__clang__) && defined (__APPLE__)
// Quick exit is missing in standard CLang headers

View File

@@ -1,4 +1,5 @@
#include "ftxui/component/toggle.hpp"
#include <algorithm>
namespace ftxui {