Variou details:

- Put the MIT copyright at the end.
- Move the directory /other -> tools
- Various improvements.
This commit is contained in:
ArthurSonzogni 2020-08-16 00:24:18 +02:00 committed by Arthur Sonzogni
parent 5a4afba66f
commit f2dc080a35
73 changed files with 353 additions and 322 deletions

View File

@ -2,4 +2,3 @@
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Chromium BasedOnStyle: Chromium
Standard: Cpp11 Standard: Cpp11
IndentPPDirectives: BeforeHash

View File

@ -29,10 +29,7 @@ A simple C++ library for terminal based user interface.
* Simple and elegant syntax (in my opinion). * Simple and elegant syntax (in my opinion).
* Support for [UTF8](https://en.wikipedia.org/wiki/UTF-8) and [fullwidth chars](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) (→ 测试) * Support for [UTF8](https://en.wikipedia.org/wiki/UTF-8) and [fullwidth chars](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) (→ 测试)
* No dependencies. * No dependencies.
* Cross platform: * Cross platform (mostly). Linux (main target), Windows (experimental), Mac.
- Linux (main target)
- Windows (experimental, thanks to mauve@)
- Mac (never tested, but must WORK)
## Example: ## Example:
~~~cpp ~~~cpp

35
doc/example_list.md Normal file
View File

@ -0,0 +1,35 @@
# Examples
@example ./examples/util/print_key_press.cpp
@example ./examples/dom/dbox.cpp
@example ./examples/dom/separator.cpp
@example ./examples/dom/style_color.cpp
@example ./examples/dom/paragraph.cpp
@example ./examples/dom/style_blink.cpp
@example ./examples/dom/style_dim.cpp
@example ./examples/dom/style_inverted.cpp
@example ./examples/dom/graph.cpp
@example ./examples/dom/package_manager.cpp
@example ./examples/dom/window.cpp
@example ./examples/dom/html_like.cpp
@example ./examples/dom/border.cpp
@example ./examples/dom/style_underlined.cpp
@example ./examples/dom/gauge.cpp
@example ./examples/dom/style_bold.cpp
@example ./examples/dom/spinner.cpp
@example ./examples/dom/style_gallery.cpp
@example ./examples/dom/vbox_hbox.cpp
@example ./examples/dom/size.cpp
@example ./examples/dom/hflow.cpp
@example ./examples/component/tab_vertical.cpp
@example ./examples/component/gallery.cpp
@example ./examples/component/checkbox.cpp
@example ./examples/component/checkbox_in_frame.cpp
@example ./examples/component/menu2.cpp
@example ./examples/component/tab_horizontal.cpp
@example ./examples/component/input.cpp
@example ./examples/component/homescreen.cpp
@example ./examples/component/radiobox.cpp
@example ./examples/component/menu.cpp
@example ./examples/component/menu_style.cpp
@example ./examples/component/radiobox_in_frame.cpp
@example ./examples/component/toggle.cpp

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_COMPONENT_CHECKBOX_HPP #ifndef FTXUI_COMPONENT_CHECKBOX_HPP
#define FTXUI_COMPONENT_CHECKBOX_HPP #define FTXUI_COMPONENT_CHECKBOX_HPP
@ -45,3 +41,7 @@ class CheckBox : public Component {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_CHECKBOX_HPP */ #endif /* end of include guard: FTXUI_COMPONENT_CHECKBOX_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_COMPONENT_COMPONENT_HPP #ifndef FTXUI_COMPONENT_COMPONENT_HPP
#define FTXUI_COMPONENT_COMPONENT_HPP #define FTXUI_COMPONENT_COMPONENT_HPP
@ -57,3 +53,7 @@ class Component {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_COMPONENT_HPP */ #endif /* end of include guard: FTXUI_COMPONENT_COMPONENT_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_COMPONENT_CONTAINER_HPP #ifndef FTXUI_COMPONENT_CONTAINER_HPP
#define FTXUI_COMPONENT_CONTAINER_HPP #define FTXUI_COMPONENT_CONTAINER_HPP
@ -47,3 +43,7 @@ class Container : public Component {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_CONTAINER_HPP */ #endif /* end of include guard: FTXUI_COMPONENT_CONTAINER_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_COMPONENT_EVENT_HPP #ifndef FTXUI_COMPONENT_EVENT_HPP
#define FTXUI_COMPONENT_EVENT_HPP #define FTXUI_COMPONENT_EVENT_HPP
@ -62,3 +58,7 @@ struct Event {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_EVENT_HPP */ #endif /* end of include guard: FTXUI_COMPONENT_EVENT_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_COMPONENT_INPUT_H_ #ifndef FTXUI_COMPONENT_INPUT_H_
#define FTXUI_COMPONENT_INPUT_H_ #define FTXUI_COMPONENT_INPUT_H_
@ -36,3 +32,7 @@ class Input : public Component {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_INPUT_H_ */ #endif /* end of include guard: FTXUI_COMPONENT_INPUT_H_ */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_COMPONENT_MENU #ifndef FTXUI_COMPONENT_MENU
#define FTXUI_COMPONENT_MENU #define FTXUI_COMPONENT_MENU
@ -38,3 +34,7 @@ class Menu : public Component {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_MENU */ #endif /* end of include guard: FTXUI_COMPONENT_MENU */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_COMPONENT_RADIOBOX_HPP #ifndef FTXUI_COMPONENT_RADIOBOX_HPP
#define FTXUI_COMPONENT_RADIOBOX_HPP #define FTXUI_COMPONENT_RADIOBOX_HPP
@ -46,3 +42,7 @@ class RadioBox : public Component {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_RADIOBOX_HPP */ #endif /* end of include guard: FTXUI_COMPONENT_RADIOBOX_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_COMPONENT_RECEIVER_HPP_ #ifndef FTXUI_COMPONENT_RECEIVER_HPP_
#define FTXUI_COMPONENT_RECEIVER_HPP_ #define FTXUI_COMPONENT_RECEIVER_HPP_
@ -118,3 +114,7 @@ Receiver<T> MakeReceiver() {
} // namespace ftxui } // namespace ftxui
#endif // FTXUI_COMPONENT_RECEIVER_HPP_ #endif // FTXUI_COMPONENT_RECEIVER_HPP_
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP #ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
#define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP #define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
@ -61,3 +57,7 @@ class ScreenInteractive : public Screen {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP */ #endif /* end of include guard: FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_COMPONENT_TOGGLE_H_ #ifndef FTXUI_COMPONENT_TOGGLE_H_
#define FTXUI_COMPONENT_TOGGLE_H_ #define FTXUI_COMPONENT_TOGGLE_H_
@ -37,3 +33,7 @@ class Toggle : public Component {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_TOGGLE_H_ */ #endif /* end of include guard: FTXUI_COMPONENT_TOGGLE_H_ */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_DOM_ELEMENTS_HPP #ifndef FTXUI_DOM_ELEMENTS_HPP
#define FTXUI_DOM_ELEMENTS_HPP #define FTXUI_DOM_ELEMENTS_HPP
@ -108,3 +104,7 @@ TAKE_ANY_ARGS(hflow)
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_DOM_ELEMENTS_HPP */ #endif /* end of include guard: FTXUI_DOM_ELEMENTS_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_DOM_NODE_HPP #ifndef FTXUI_DOM_NODE_HPP
#define FTXUI_DOM_NODE_HPP #define FTXUI_DOM_NODE_HPP
@ -50,3 +46,7 @@ void Render(Screen& screen, Node* node);
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_DOM_NODE_HPP */ #endif /* end of include guard: FTXUI_DOM_NODE_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_DOM_REQUIREMENT_HPP #ifndef FTXUI_DOM_REQUIREMENT_HPP
#define FTXUI_DOM_REQUIREMENT_HPP #define FTXUI_DOM_REQUIREMENT_HPP
@ -33,3 +29,7 @@ struct Requirement {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_REQUIREMENT_HPP */ #endif /* end of include guard: FTXUI_REQUIREMENT_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include <type_traits> #include <type_traits>
template <class T> template <class T>
@ -32,3 +28,7 @@ Elements unpack(Args... args) {
Element container(Args... children) { \ Element container(Args... children) { \
return container(unpack(std::forward<Args>(children)...)); \ return container(unpack(std::forward<Args>(children)...)); \
} }
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_SCREEN_BOX_HPP #ifndef FTXUI_SCREEN_BOX_HPP
#define FTXUI_SCREEN_BOX_HPP #define FTXUI_SCREEN_BOX_HPP
@ -19,3 +15,7 @@ struct Box {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_SCREEN_BOX_HPP */ #endif /* end of include guard: FTXUI_SCREEN_BOX_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_SCREEN_COLOR #ifndef FTXUI_SCREEN_COLOR
#define FTXUI_SCREEN_COLOR #define FTXUI_SCREEN_COLOR
@ -44,3 +40,7 @@ enum class Color : uint8_t {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COLOR_H_ */ #endif /* end of include guard: FTXUI_COLOR_H_ */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_SCREEN_SCREEN #ifndef FTXUI_SCREEN_SCREEN
#define FTXUI_SCREEN_SCREEN #define FTXUI_SCREEN_SCREEN
@ -91,3 +87,7 @@ class Screen {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_SCREEN_SCREEN */ #endif /* end of include guard: FTXUI_SCREEN_SCREEN */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_SCREEN_STRING_HPP #ifndef FTXUI_SCREEN_STRING_HPP
#define FTXUI_SCREEN_STRING_HPP #define FTXUI_SCREEN_STRING_HPP
@ -23,3 +19,7 @@ int wstring_width_cjk(const std::wstring&);
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_SCREEN_STRING_HPP */ #endif /* end of include guard: FTXUI_SCREEN_STRING_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_UTIL_AUTORESET_HPP #ifndef FTXUI_UTIL_AUTORESET_HPP
#define FTXUI_UTIL_AUTORESET_HPP #define FTXUI_UTIL_AUTORESET_HPP
@ -24,3 +20,7 @@ class AutoReset {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_UTIL_AUTORESET_HPP */ #endif /* end of include guard: FTXUI_UTIL_AUTORESET_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/checkbox.hpp" #include "ftxui/component/checkbox.hpp"
#include <functional> #include <functional>
@ -26,3 +22,7 @@ bool CheckBox::OnEvent(Event event) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/component.hpp" #include "ftxui/component/component.hpp"
#include <assert.h> #include <assert.h>
@ -63,3 +59,7 @@ bool Component::Focused() {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/container.hpp" #include "ftxui/component/container.hpp"
#include <algorithm> #include <algorithm>
@ -111,3 +107,7 @@ Element Container::TabRender() {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/container.hpp" #include "ftxui/component/container.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -78,3 +74,7 @@ TEST(ContainerTest, HorizontalEvent) {
EXPECT_EQ(container.ActiveChild(), &c1); EXPECT_EQ(container.ActiveChild(), &c1);
container.OnEvent(Event::TabReverse); container.OnEvent(Event::TabReverse);
} }
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/event.hpp" #include "ftxui/component/event.hpp"
#include <iostream> #include <iostream>
@ -189,3 +185,7 @@ Event Event::F12 = Event::Special("\x1B[24~");
Event Event::Custom = Event::Special({0}); Event Event::Custom = Event::Special({0});
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/event.hpp" #include "ftxui/component/event.hpp"
#include "ftxui/component/receiver.hpp" #include "ftxui/component/receiver.hpp"
@ -47,3 +43,7 @@ TEST(Event, Character) {
} }
EXPECT_FALSE(event_receiver->Receive(&received)); EXPECT_FALSE(event_receiver->Receive(&received));
} }
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/input.hpp" #include "ftxui/component/input.hpp"
#include <algorithm> #include <algorithm>
@ -97,3 +93,7 @@ bool Input::OnEvent(Event event) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/menu.hpp" #include "ftxui/component/menu.hpp"
#include <algorithm> #include <algorithm>
@ -53,3 +49,7 @@ bool Menu::OnEvent(Event event) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/radiobox.hpp" #include "ftxui/component/radiobox.hpp"
#include <algorithm> #include <algorithm>
@ -55,3 +51,7 @@ bool RadioBox::OnEvent(Event event) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/radiobox.hpp" #include "ftxui/component/radiobox.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -80,3 +76,7 @@ TEST(RadioboxTest, Navigation) {
EXPECT_EQ(radiobox.focused, 1); EXPECT_EQ(radiobox.focused, 1);
radiobox.OnEvent(Event::TabReverse); radiobox.OnEvent(Event::TabReverse);
} }
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/receiver.hpp" #include "ftxui/component/receiver.hpp"
#include <thread> #include <thread>
@ -76,3 +72,7 @@ TEST(Receiver, BasicWithThread) {
t12.join(); t12.join();
t23.join(); t23.join();
} }
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/screen_interactive.hpp" #include "ftxui/component/screen_interactive.hpp"
#include <stdio.h> #include <stdio.h>
@ -18,23 +14,23 @@
#include "ftxui/screen/terminal.hpp" #include "ftxui/screen/terminal.hpp"
#if defined(_WIN32) #if defined(_WIN32)
#define DEFINE_CONSOLEV2_PROPERTIES #define DEFINE_CONSOLEV2_PROPERTIES
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX #ifndef NOMINMAX
#define NOMINMAX #define NOMINMAX
#endif #endif
#include <Windows.h> #include <Windows.h>
#ifndef UNICODE #ifndef UNICODE
#error Must be compiled in UNICODE mode #error Must be compiled in UNICODE mode
#endif #endif
#else #else
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
#endif #endif
// Quick exit is missing in standard CLang headers // Quick exit is missing in standard CLang headers
#if defined(__clang__) && defined(__APPLE__) #if defined(__clang__) && defined(__APPLE__)
#define quick_exit(a) exit(a) #define quick_exit(a) exit(a)
#endif #endif
namespace ftxui { namespace ftxui {
@ -365,3 +361,7 @@ std::function<void()> ScreenInteractive::ExitLoopClosure() {
} }
} // namespace ftxui. } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/toggle.hpp" #include "ftxui/component/toggle.hpp"
#include <algorithm> #include <algorithm>
@ -54,3 +50,7 @@ bool Toggle::OnEvent(Event event) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/component/toggle.hpp" #include "ftxui/component/toggle.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -83,23 +79,23 @@ TEST(ToggleTest, OnChange) {
int counter = 0; int counter = 0;
toggle.on_change = [&] { counter++; }; toggle.on_change = [&] { counter++; };
EXPECT_FALSE(toggle.OnEvent(Event::ArrowLeft)); // Reached far left. EXPECT_FALSE(toggle.OnEvent(Event::ArrowLeft)); // Reached far left.
EXPECT_EQ(counter, 0); EXPECT_EQ(counter, 0);
EXPECT_TRUE(toggle.OnEvent(Event::ArrowRight)); // [0] -> [1] EXPECT_TRUE(toggle.OnEvent(Event::ArrowRight)); // [0] -> [1]
EXPECT_EQ(counter, 1); EXPECT_EQ(counter, 1);
EXPECT_TRUE(toggle.OnEvent(Event::ArrowRight)); // [1] -> [2] EXPECT_TRUE(toggle.OnEvent(Event::ArrowRight)); // [1] -> [2]
EXPECT_EQ(counter, 2); EXPECT_EQ(counter, 2);
EXPECT_FALSE(toggle.OnEvent(Event::ArrowRight)); // Reached far right. EXPECT_FALSE(toggle.OnEvent(Event::ArrowRight)); // Reached far right.
EXPECT_EQ(counter, 2); EXPECT_EQ(counter, 2);
EXPECT_TRUE(toggle.OnEvent(Event::ArrowLeft)); // [2] -> [1] EXPECT_TRUE(toggle.OnEvent(Event::ArrowLeft)); // [2] -> [1]
EXPECT_EQ(counter, 3); EXPECT_EQ(counter, 3);
EXPECT_TRUE(toggle.OnEvent(Event::ArrowLeft)); // [1] -> [0] EXPECT_TRUE(toggle.OnEvent(Event::ArrowLeft)); // [1] -> [0]
EXPECT_EQ(counter, 4); EXPECT_EQ(counter, 4);
EXPECT_FALSE(toggle.OnEvent(Event::ArrowLeft)); // Reached far left. EXPECT_FALSE(toggle.OnEvent(Event::ArrowLeft)); // Reached far left.
EXPECT_EQ(counter, 4); EXPECT_EQ(counter, 4);
} }
@ -110,29 +106,33 @@ TEST(ToggleTest, OnEnter) {
int counter = 0; int counter = 0;
toggle.on_enter = [&] { counter++; }; toggle.on_enter = [&] { counter++; };
EXPECT_FALSE(toggle.OnEvent(Event::ArrowLeft)); // Reached far left. EXPECT_FALSE(toggle.OnEvent(Event::ArrowLeft)); // Reached far left.
EXPECT_TRUE(toggle.OnEvent(Event::Return)); EXPECT_TRUE(toggle.OnEvent(Event::Return));
EXPECT_EQ(counter, 1); EXPECT_EQ(counter, 1);
EXPECT_TRUE(toggle.OnEvent(Event::ArrowRight)); // [0] -> [1] EXPECT_TRUE(toggle.OnEvent(Event::ArrowRight)); // [0] -> [1]
EXPECT_TRUE(toggle.OnEvent(Event::Return)); EXPECT_TRUE(toggle.OnEvent(Event::Return));
EXPECT_EQ(counter, 2); EXPECT_EQ(counter, 2);
EXPECT_TRUE(toggle.OnEvent(Event::ArrowRight)); // [1] -> [2] EXPECT_TRUE(toggle.OnEvent(Event::ArrowRight)); // [1] -> [2]
EXPECT_TRUE(toggle.OnEvent(Event::Return)); EXPECT_TRUE(toggle.OnEvent(Event::Return));
EXPECT_EQ(counter, 3); EXPECT_EQ(counter, 3);
EXPECT_FALSE(toggle.OnEvent(Event::ArrowRight)); // Reached far right. EXPECT_FALSE(toggle.OnEvent(Event::ArrowRight)); // Reached far right.
EXPECT_TRUE(toggle.OnEvent(Event::Return)); EXPECT_TRUE(toggle.OnEvent(Event::Return));
EXPECT_EQ(counter, 4); EXPECT_EQ(counter, 4);
EXPECT_TRUE(toggle.OnEvent(Event::ArrowLeft)); // [2] -> [1] EXPECT_TRUE(toggle.OnEvent(Event::ArrowLeft)); // [2] -> [1]
EXPECT_TRUE(toggle.OnEvent(Event::Return)); EXPECT_TRUE(toggle.OnEvent(Event::Return));
EXPECT_EQ(counter, 5); EXPECT_EQ(counter, 5);
EXPECT_TRUE(toggle.OnEvent(Event::ArrowLeft)); // [1] -> [0] EXPECT_TRUE(toggle.OnEvent(Event::ArrowLeft)); // [1] -> [0]
EXPECT_TRUE(toggle.OnEvent(Event::Return)); EXPECT_TRUE(toggle.OnEvent(Event::Return));
EXPECT_EQ(counter, 6); EXPECT_EQ(counter, 6);
EXPECT_FALSE(toggle.OnEvent(Event::ArrowLeft)); // Reached far left. EXPECT_FALSE(toggle.OnEvent(Event::ArrowLeft)); // Reached far left.
EXPECT_TRUE(toggle.OnEvent(Event::Return)); EXPECT_TRUE(toggle.OnEvent(Event::Return));
EXPECT_EQ(counter, 7); EXPECT_EQ(counter, 7);
} }
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node_decorator.hpp" #include "ftxui/dom/node_decorator.hpp"
@ -29,3 +25,7 @@ Element blink(Element child) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node_decorator.hpp" #include "ftxui/dom/node_decorator.hpp"
@ -29,3 +25,7 @@ Element bold(Element child) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include <algorithm>
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp" #include "ftxui/dom/node.hpp"
@ -164,3 +160,7 @@ Decorator borderWith(Pixel pixel) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node_decorator.hpp" #include "ftxui/dom/node_decorator.hpp"
@ -101,3 +97,7 @@ Decorator bgcolor(Color c) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp" #include "ftxui/dom/node.hpp"
@ -40,3 +36,7 @@ Element align_right(Element child) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include <algorithm> #include <algorithm>
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
@ -52,3 +48,7 @@ Element dbox(Elements children) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node_decorator.hpp" #include "ftxui/dom/node_decorator.hpp"
@ -31,3 +27,7 @@ Element dim(Element child) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp" #include "ftxui/dom/node.hpp"
@ -155,3 +151,7 @@ Element notflex(Element child) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include <algorithm> #include <algorithm>
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
@ -127,3 +123,7 @@ Element yframe(Element child) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp" #include "ftxui/dom/node.hpp"
@ -62,3 +58,7 @@ Element gauge(float progress) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp" #include "ftxui/screen/screen.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -33,3 +29,7 @@ TEST(GaugeTest, one) {
EXPECT_EQ("███████████", screen.ToString()); EXPECT_EQ("███████████", screen.ToString());
} }
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
namespace ftxui { namespace ftxui {
@ -51,3 +47,7 @@ Element graph(GraphFunction graph_function) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include <algorithm> #include <algorithm>
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
@ -145,3 +141,7 @@ Element hbox(Elements children) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp" #include "ftxui/screen/screen.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -353,3 +349,7 @@ TEST(HBoxTest, FlexGrow_NoFlex_FlewShrink) {
EXPECT_EQ(expectations[i], screen.ToString()); EXPECT_EQ(expectations[i], screen.ToString());
} }
} }
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include <algorithm> #include <algorithm>
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
@ -77,3 +73,7 @@ Element hflow(Elements children) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node_decorator.hpp" #include "ftxui/dom/node_decorator.hpp"
@ -29,3 +25,7 @@ Element inverted(Element child) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/node.hpp" #include "ftxui/dom/node.hpp"
namespace ftxui { namespace ftxui {
@ -52,3 +48,7 @@ void Render(Screen& screen, Node* node) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/node_decorator.hpp" #include "ftxui/dom/node_decorator.hpp"
namespace ftxui { namespace ftxui {
@ -17,3 +13,7 @@ void NodeDecorator::SetBox(Box box) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_DOM_NODE_DECORATOR_H_ #ifndef FTXUI_DOM_NODE_DECORATOR_H_
#define FTXUI_DOM_NODE_DECORATOR_H_ #define FTXUI_DOM_NODE_DECORATOR_H_
@ -21,3 +17,7 @@ class NodeDecorator : public Node {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_DOM_NODE_DECORATOR_H_ */ #endif /* end of include guard: FTXUI_DOM_NODE_DECORATOR_H_ */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include <sstream> #include <sstream>
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
@ -19,3 +15,7 @@ Elements paragraph(std::wstring the_text) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/node.hpp" #include "ftxui/dom/node.hpp"
namespace ftxui { namespace ftxui {
@ -58,3 +54,7 @@ Element separator(Pixel pixel) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include <algorithm> #include <algorithm>
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
@ -84,3 +80,7 @@ Decorator size(Direction direction, Constraint constraint, int value) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp" #include "ftxui/dom/node.hpp"
@ -261,3 +257,7 @@ Element spinner(int c, size_t index) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include <algorithm> #include <algorithm>
#include "ftxui/dom/node.hpp" #include "ftxui/dom/node.hpp"
#include "ftxui/screen/string.hpp" #include "ftxui/screen/string.hpp"
@ -77,3 +73,7 @@ Element vtext(std::wstring text) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp" #include "ftxui/screen/screen.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -84,3 +80,7 @@ TEST(TextTest, CJK_3) {
"└──┘", "└──┘",
screen.ToString()); screen.ToString());
} }
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node_decorator.hpp" #include "ftxui/dom/node_decorator.hpp"
@ -29,3 +25,7 @@ Element underlined(Element child) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
namespace ftxui { namespace ftxui {
@ -32,3 +28,7 @@ Element operator|(Element e, Decorator d) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
@ -146,3 +142,7 @@ Element vbox(Elements children) {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp" #include "ftxui/screen/screen.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -358,3 +354,7 @@ TEST(VBoxText, FlexGrow_NoFlex_FlewShrink) {
EXPECT_EQ(expectations[i], rotate(screen.ToString())); EXPECT_EQ(expectations[i], rotate(screen.ToString()));
} }
} }
// 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/screen/box.hpp" #include "ftxui/screen/box.hpp"
#include <algorithm> #include <algorithm>
@ -17,3 +13,7 @@ Box Box::Intersection(Box a, Box b) {
}; };
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/screen/screen.hpp" #include "ftxui/screen/screen.hpp"
#include <algorithm> #include <algorithm>
@ -12,11 +8,11 @@
#include "ftxui/screen/terminal.hpp" #include "ftxui/screen/terminal.hpp"
#if defined(_WIN32) #if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX #ifndef NOMINMAX
#define NOMINMAX #define NOMINMAX
#endif #endif
#include <Windows.h> #include <Windows.h>
#endif #endif
namespace ftxui { namespace ftxui {
@ -249,3 +245,7 @@ void Screen::ApplyShader() {
// clang-format on // clang-format on
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#include "ftxui/screen/string.hpp" #include "ftxui/screen/string.hpp"
#include <codecvt> #include <codecvt>
@ -9,8 +5,8 @@
namespace ftxui { namespace ftxui {
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4996) // codecvt_utf8_utf16 is deprecated #pragma warning(disable : 4996) // codecvt_utf8_utf16 is deprecated
#endif #endif
std::string to_string(const std::wstring& s) { std::string to_string(const std::wstring& s) {
@ -24,7 +20,11 @@ std::wstring to_wstring(const std::string& s) {
} }
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(pop) #pragma warning(pop)
#endif #endif
} // namespace ftxui } // 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.

View File

@ -1,18 +1,14 @@
// 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.
#include "ftxui/screen/terminal.hpp" #include "ftxui/screen/terminal.hpp"
#include <stdio.h> #include <stdio.h>
#if defined(_WIN32) #if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define NOMINMAX #define NOMINMAX
#include <Windows.h> #include <Windows.h>
#else #else
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <iostream> #include <iostream>
@ -38,3 +34,7 @@ Terminal::Dimensions Terminal::Size() {
} }
} // namespace ftxui } // 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.

View File

@ -1,7 +1,3 @@
// 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.
#ifndef FTXUI_CORE_TERMINAL_HPP #ifndef FTXUI_CORE_TERMINAL_HPP
#define FTXUI_CORE_TERMINAL_HPP #define FTXUI_CORE_TERMINAL_HPP
@ -20,3 +16,7 @@ class Terminal {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_CORE_TERMINAL_HPP */ #endif /* end of include guard: FTXUI_CORE_TERMINAL_HPP */
// 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.

View File

@ -1,7 +1,3 @@
// 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.
/* /*
* This is an implementation of wcwidth() and wcswidth() (defined in * This is an implementation of wcwidth() and wcswidth() (defined in
* IEEE Std 1002.1-2001) for Unicode. * IEEE Std 1002.1-2001) for Unicode.
@ -307,3 +303,7 @@ int wstring_width_cjk(const std::wstring& text) {
} }
} // namespace ftxui } // 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.

View File

@ -8,7 +8,7 @@ for file in $files
do do
if ! grep -q Copyright $file if ! grep -q Copyright $file
then then
cat ./other/license_headers.cpp $file >$file.new && mv $file.new $file cat $file ./other/license_headers.cpp > $file.new && mv $file.new $file
fi fi
done done

View File

@ -1,4 +1,4 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved. // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.