From 5410329ac686f98abfd99b0fae27ebdc098500be Mon Sep 17 00:00:00 2001 From: Arthur Sonzogni Date: Fri, 6 Jan 2023 11:05:56 +0100 Subject: [PATCH] Adding heartbeat to spinner (#548) Co-authored-by: cyrus --- examples/dom/spinner.cpp | 2 +- src/ftxui/dom/spinner.cpp | 143 ++++++++++++++++++++++---------------- 2 files changed, 83 insertions(+), 62 deletions(-) diff --git a/examples/dom/spinner.cpp b/examples/dom/spinner.cpp index 821f740..d73c77b 100644 --- a/examples/dom/spinner.cpp +++ b/examples/dom/spinner.cpp @@ -17,7 +17,7 @@ int main(int argc, const char* argv[]) { std::string reset_position; for (int index = 0; index < 200; ++index) { std::vector entries; - for (int i = 0; i < 22; ++i) { + for (int i = 0; i < 23; ++i) { if (i != 0) entries.push_back(separator()); entries.push_back( // diff --git a/src/ftxui/dom/spinner.cpp b/src/ftxui/dom/spinner.cpp index 3e7c240..da7860c 100644 --- a/src/ftxui/dom/spinner.cpp +++ b/src/ftxui/dom/spinner.cpp @@ -186,67 +186,88 @@ const std::vector>> elements = { {"[ == ]"}, {"[ == ]"}, }, - {{ - " ─╮", - " │", - " ", - }, - { - " ╮", - " │", - " ╯", - }, - { - " ", - " │", - " ─╯", - }, - { - " ", - " ", - "╰─╯", - }, - { - " ", - "│ ", - "╰─ ", - }, - { - "╭ ", - "│ ", - "╰ ", - }, - { - "╭─ ", - "│ ", - " ", - }, - { - "╭─╮", - " ", - " ", - }}, - {{ - " /\\O ", - " /\\/", - " /\\ ", - " / \\ ", - "LOL LOL", - }, - { - " _O ", - " //|_ ", - " | ", - " /| ", - " LLOL ", - }, - { - " O ", - " /_ ", - " |\\ ", - " / | ", - " LOLLOL ", - }}}; + { + { + " ─╮", + " │", + " ", + }, + { + " ╮", + " │", + " ╯", + }, + { + " ", + " │", + " ─╯", + }, + { + " ", + " ", + "╰─╯", + }, + { + " ", + "│ ", + "╰─ ", + }, + { + "╭ ", + "│ ", + "╰ ", + }, + { + "╭─ ", + "│ ", + " ", + }, + { + "╭─╮", + " ", + " ", + }, + }, + { + { + " /\\O ", + " /\\/", + " /\\ ", + " / \\ ", + "LOL LOL", + }, + { + " _O ", + " //|_ ", + " | ", + " /| ", + " LLOL ", + }, + { + " O ", + " /_ ", + " |\\ ", + " / | ", + " LOLLOL ", + }, + }, + { + {" ", "_______", " "}, + {" ", "______/", " "}, + {" _", "_____/ ", " "}, + {" _ ", "____/ \\", " "}, + {" _ ", "___/ \\ ", " \\"}, + {" _ ", "__/ \\ ", " \\_"}, + {" _ ", "_/ \\ ", " \\_/"}, + {" _ ", "/ \\ _", " \\_/ "}, + {"_ ", " \\ __", " \\_/ "}, + {" ", "\\ ___", " \\_/ "}, + {" ", " ___", "\\_/ "}, + {" ", " _____", "_/ "}, + {" ", " ______", "/ "}, + {" ", "_______", " "}, + }, +}; } // namespace