mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-01 02:58:12 +08:00 
			
		
		
		
	Set clang-format macro indent.
1) Set clang-format macro indent. 2) Run clang-format on every files.
This commit is contained in:
		| @@ -2,3 +2,4 @@ | ||||
| # http://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||||
| BasedOnStyle: Chromium | ||||
| Standard: Cpp11 | ||||
| IndentPPDirectives: BeforeHash | ||||
|   | ||||
| @@ -1,9 +1,10 @@ | ||||
| #ifndef FTXUI_COMPONENT_CHECKBOX_HPP | ||||
| #define FTXUI_COMPONENT_CHECKBOX_HPP | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include <functional> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class CheckBox : public Component { | ||||
|   | ||||
| @@ -11,7 +11,6 @@ class Focus; | ||||
|  | ||||
| class Component { | ||||
|  public: | ||||
|  | ||||
|   // Constructor/Destructor. | ||||
|   Component() = default; | ||||
|   virtual ~Component(); | ||||
|   | ||||
| @@ -1,9 +1,10 @@ | ||||
| #ifndef FTXUI_COMPONENT_INPUT_H_ | ||||
| #define FTXUI_COMPONENT_INPUT_H_ | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include <functional> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class Input : public Component { | ||||
|   | ||||
| @@ -1,9 +1,10 @@ | ||||
| #ifndef FTXUI_COMPONENT_MENU | ||||
| #define FTXUI_COMPONENT_MENU | ||||
|  | ||||
| #include <functional> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include <functional> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| @@ -30,6 +31,6 @@ class Menu : public Component { | ||||
|   bool OnEvent(Event) override; | ||||
| }; | ||||
|  | ||||
| }  // namespace ftxui::Component | ||||
| }  // namespace ftxui | ||||
|  | ||||
| #endif /* end of include guard: FTXUI_COMPONENT_MENU */ | ||||
|   | ||||
| @@ -1,9 +1,10 @@ | ||||
| #ifndef FTXUI_COMPONENT_RADIOBOX_HPP | ||||
| #define FTXUI_COMPONENT_RADIOBOX_HPP | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include <functional> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class RadioBox : public Component { | ||||
|   | ||||
| @@ -1,12 +1,12 @@ | ||||
| #ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP | ||||
| #define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP | ||||
|  | ||||
| #include <atomic> | ||||
| #include <condition_variable> | ||||
| #include <functional> | ||||
| #include <memory> | ||||
| #include <mutex> | ||||
| #include <queue> | ||||
| #include <atomic> | ||||
|  | ||||
| #include "ftxui/component/event.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|   | ||||
| @@ -1,10 +1,11 @@ | ||||
| #ifndef FTXUI_COMPONENT_TOGGLE_H_ | ||||
| #define FTXUI_COMPONENT_TOGGLE_H_ | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include <functional> | ||||
| #include <string> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class Toggle : public Component { | ||||
| @@ -28,6 +29,6 @@ class Toggle : public Component { | ||||
|   bool OnEvent(Event) override; | ||||
| }; | ||||
|  | ||||
| }  // namespace ftxui::Component | ||||
| }  // namespace ftxui | ||||
|  | ||||
| #endif /* end of include guard: FTXUI_COMPONENT_TOGGLE_H_ */ | ||||
|   | ||||
| @@ -30,6 +30,7 @@ class Node { | ||||
|   virtual void Render(Screen& screen); | ||||
|  | ||||
|   std::vector<std::unique_ptr<Node>> children; | ||||
|  | ||||
|  protected: | ||||
|   Requirement requirement_; | ||||
|   Box box_; | ||||
|   | ||||
| @@ -7,10 +7,16 @@ namespace ftxui { | ||||
|  | ||||
| struct Requirement { | ||||
|   // The required size to fully draw the element. | ||||
|   struct { int x = 0; int y = 0; } min; | ||||
|   struct { | ||||
|     int x = 0; | ||||
|     int y = 0; | ||||
|   } min; | ||||
|  | ||||
|   // How much flexibility is given to the component. | ||||
|   struct { int x = 0; int y = 0; } flex; | ||||
|   struct { | ||||
|     int x = 0; | ||||
|     int y = 0; | ||||
|   } flex; | ||||
|  | ||||
|   // Frame. | ||||
|   enum Selection { | ||||
|   | ||||
| @@ -1,12 +1,12 @@ | ||||
| #ifndef FTXUI_SCREEN_SCREEN | ||||
| #define FTXUI_SCREEN_SCREEN | ||||
|  | ||||
| #include <memory> | ||||
| #include <string> | ||||
| #include <vector> | ||||
| #include <memory> | ||||
|  | ||||
| #include "ftxui/screen/color.hpp" | ||||
| #include "ftxui/screen/box.hpp" | ||||
| #include "ftxui/screen/color.hpp" | ||||
|  | ||||
| namespace ftxui { | ||||
| class Node; | ||||
|   | ||||
| @@ -7,11 +7,11 @@ template<typename T> | ||||
| class AutoReset { | ||||
|  public: | ||||
|   AutoReset(T* variable, T new_value) | ||||
|       : variable_(variable), | ||||
|         previous_value_(std::move(*variable)) { | ||||
|       : variable_(variable), previous_value_(std::move(*variable)) { | ||||
|     *variable_ = std::move(new_value); | ||||
|   } | ||||
|   ~AutoReset() { *variable_ = std::move(previous_value_); } | ||||
|  | ||||
|  private: | ||||
|   T* variable_; | ||||
|   T previous_value_; | ||||
|   | ||||
| @@ -1,7 +1,9 @@ | ||||
| #include "ftxui/component/input.hpp" | ||||
| #include "ftxui/screen/string.hpp" | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| #include "ftxui/screen/string.hpp" | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| // Component implementation. | ||||
| @@ -29,8 +31,7 @@ Element Input::Render() { | ||||
|   std::wstring part_after_cursor = cursor_position < (int)content.size() - 1 | ||||
|                                        ? content.substr(cursor_position + 1) | ||||
|                                        : L""; | ||||
|   auto focused =  | ||||
|     is_focused ? focus : select; | ||||
|   auto focused = is_focused ? focus : select; | ||||
|  | ||||
|   // clang-format off | ||||
|   return | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| #include "ftxui/component/menu.hpp" | ||||
|  | ||||
| #include <algorithm> | ||||
| #include <iostream> | ||||
| #include <algorithm> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| #include "ftxui/component/radiobox.hpp" | ||||
| #include <functional> | ||||
|  | ||||
| #include <algorithm> | ||||
| #include <functional> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
|   | ||||
| @@ -3,14 +3,16 @@ | ||||
| #include <stdio.h> | ||||
| #include <termios.h> | ||||
| #include <unistd.h> | ||||
|  | ||||
| #include <algorithm> | ||||
| #include <csignal> | ||||
| #include <iostream> | ||||
| #include <stack> | ||||
| #include <thread> | ||||
|  | ||||
| #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 | ||||
| @@ -47,9 +49,7 @@ void OnResize(int /* signal */) { | ||||
|   on_resize(); | ||||
| } | ||||
|  | ||||
| ScreenInteractive::ScreenInteractive(int dimx, | ||||
|                                      int dimy, | ||||
|                                      Dimension dimension) | ||||
| ScreenInteractive::ScreenInteractive(int dimx, int dimy, Dimension dimension) | ||||
|     : Screen(dimx, dimy), dimension_(dimension) {} | ||||
| ScreenInteractive::~ScreenInteractive() {} | ||||
|  | ||||
| @@ -176,8 +176,7 @@ void ScreenInteractive::Draw(Component* component) { | ||||
|   if (dimx != dimx_ || dimy != dimy_) { | ||||
|     dimx_ = dimx; | ||||
|     dimy_ = dimy; | ||||
|     pixels_ = std::vector<std::vector<Pixel>>( | ||||
|         dimy, std::vector<Pixel>(dimx)); | ||||
|     pixels_ = std::vector<std::vector<Pixel>>(dimy, std::vector<Pixel>(dimx)); | ||||
|     cursor_.x = dimx_ - 1; | ||||
|     cursor_.y = dimy_ - 1; | ||||
|   } | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| #include "ftxui/component/toggle.hpp" | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| namespace ftxui { | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| #include <algorithm> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/dom/node.hpp" | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| using namespace ftxui; | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| #include <algorithm> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/dom/node.hpp" | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class DBox : public Node { | ||||
|   | ||||
| @@ -4,8 +4,6 @@ | ||||
| #include "ftxui/dom/node.hpp" | ||||
| #include "ftxui/util/autoreset.hpp" | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| using namespace ftxui; | ||||
|   | ||||
| @@ -3,8 +3,6 @@ | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/dom/node.hpp" | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class HBox : public Node { | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| #include <algorithm> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/dom/node.hpp" | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class HFlow : public Node { | ||||
|   | ||||
| @@ -3,8 +3,6 @@ | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/dom/node.hpp" | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class Size : public Node { | ||||
|   | ||||
| @@ -3,8 +3,6 @@ | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/dom/node.hpp" | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| class VBox : public Node { | ||||
|   | ||||
| @@ -7,7 +7,6 @@ | ||||
| #include "ftxui/screen/string.hpp" | ||||
| #include "ftxui/screen/terminal.hpp" | ||||
|  | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| namespace { | ||||
|   | ||||
| @@ -59,9 +59,10 @@ | ||||
|  * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c | ||||
|  */ | ||||
|  | ||||
| #include "ftxui/screen/string.hpp" | ||||
| #include <wchar.h> | ||||
|  | ||||
| #include "ftxui/screen/string.hpp" | ||||
|  | ||||
| namespace { | ||||
| struct interval { | ||||
|   int first; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ArthurSonzogni
					ArthurSonzogni