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:
		| @@ -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. | ||||
| @@ -22,15 +24,14 @@ Element Input::Render() { | ||||
|   if (!is_focused) | ||||
|     return text(content) | main_decorator; | ||||
|  | ||||
|   std::wstring part_before_cursor = content.substr(0,cursor_position); | ||||
|   std::wstring part_before_cursor = content.substr(0, cursor_position); | ||||
|   std::wstring part_at_cursor = cursor_position < (int)content.size() | ||||
|                                     ? content.substr(cursor_position, 1) | ||||
|                                     : L" "; | ||||
|   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 { | ||||
|  | ||||
| @@ -41,7 +42,7 @@ bool RadioBox::OnEvent(Event event) { | ||||
|     return true; | ||||
|   } | ||||
|  | ||||
|   if (event == Event::Character(' ') || event==Event::Return) { | ||||
|   if (event == Event::Character(' ') || event == Event::Return) { | ||||
|     selected = focused; | ||||
|     on_change(); | ||||
|   } | ||||
|   | ||||
| @@ -3,18 +3,20 @@ | ||||
| #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 | ||||
|     #define quick_exit(a) exit(a) | ||||
| #if defined(__clang__) && defined(__APPLE__) | ||||
|   // Quick exit is missing in standard CLang headers | ||||
|   #define quick_exit(a) exit(a) | ||||
| #endif | ||||
|  | ||||
| namespace ftxui { | ||||
| @@ -42,14 +44,12 @@ auto install_signal_handler = [](int sig, SignalHandler handler) { | ||||
|   on_exit_functions.push([&]() { std::signal(sig, old_signal_handler); }); | ||||
| }; | ||||
|  | ||||
| std::function<void()> on_resize = []{}; | ||||
| std::function<void()> on_resize = [] {}; | ||||
| 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; | ||||
|   } | ||||
| @@ -196,7 +195,7 @@ void ScreenInteractive::Draw(Component* component) { | ||||
|     reset_cursor_position += "\x1B[" + std::to_string(dx) + "C"; | ||||
|   } | ||||
|   if (dy != 0) { | ||||
|     set_cursor_position +=  "\x1B[" + std::to_string(dy) + "A"; | ||||
|     set_cursor_position += "\x1B[" + std::to_string(dy) + "A"; | ||||
|     reset_cursor_position += "\x1B[" + std::to_string(dy) + "B"; | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -3,12 +3,12 @@ | ||||
| #include <stdio.h> | ||||
|  | ||||
| #ifdef WIN32 | ||||
| #define WIN32_LEAN_AND_MEAN | ||||
| #define NOMINMAX | ||||
| #include <Windows.h> | ||||
|   #define WIN32_LEAN_AND_MEAN | ||||
|   #define NOMINMAX | ||||
|   #include <Windows.h> | ||||
| #else | ||||
| #include <sys/ioctl.h> | ||||
| #include <unistd.h> | ||||
|   #include <sys/ioctl.h> | ||||
|   #include <unistd.h> | ||||
| #endif | ||||
|  | ||||
| #include <iostream> | ||||
|   | ||||
| @@ -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