Compare commits

..

4 Commits

Author SHA1 Message Date
Clément Roblot
d69f4ff128
Merge 7cdf9a4890 into 535290bb3b 2024-08-15 23:05:19 +08:00
Sergey Latu
535290bb3b
My project added to readme (#916)
Some checks failed
Build / Tests (cl, Windows MSVC, windows-latest) (push) Waiting to run
Build / Tests (llvm, llvm-cov gcov, MacOS clang, macos-latest) (push) Waiting to run
Build / Create release (push) Blocked by required conditions
Build / Build packages (build/ftxui*Darwin*, macos-latest) (push) Blocked by required conditions
Build / Build packages (build/ftxui*Linux*, ubuntu-latest) (push) Blocked by required conditions
Build / Build packages (build/ftxui*Win64*, windows-latest) (push) Blocked by required conditions
Build / Tests (gcc, gcov, Linux GCC, ubuntu-latest) (push) Failing after 7m46s
Build / Tests (llvm, llvm-cov gcov, Linux Clang, ubuntu-latest) (push) Failing after 6m6s
Build / documentation (push) Failing after 5s
CodeQL / Analyze (cpp) (push) Failing after 5s
2024-08-15 16:08:32 +02:00
Arthur Sonzogni
fcd050c017
Table: support initializer list constructor. (#915)
Some checks failed
Build / Tests (gcc, gcov, Linux GCC, ubuntu-latest) (push) Failing after 9m27s
Build / Tests (llvm, llvm-cov gcov, Linux Clang, ubuntu-latest) (push) Failing after 6s
Build / documentation (push) Failing after 5s
CodeQL / Analyze (cpp) (push) Failing after 24s
Build / Tests (cl, Windows MSVC, windows-latest) (push) Has been cancelled
Build / Tests (llvm, llvm-cov gcov, MacOS clang, macos-latest) (push) Has been cancelled
Build / Create release (push) Has been cancelled
Build / Build packages (build/ftxui*Darwin*, macos-latest) (push) Has been cancelled
Build / Build packages (build/ftxui*Linux*, ubuntu-latest) (push) Has been cancelled
Build / Build packages (build/ftxui*Win64*, windows-latest) (push) Has been cancelled
To avoid burdening the user with explicit type construction when using
the library, we can use a constructor that accepts an initializer list
(std::initializer_list). This allows users to pass initializer lists
directly without having to wrap them in
std::vector<std::vector<std::string>>. This resolves the ambiguous case
when the inner list contains only two elements.

Bug:https://github.com/ArthurSonzogni/FTXUI/issues/912
2024-08-13 15:55:09 +02:00
Paolo Bosetti
d7de24cd9e
Added -fPIC compile option (#913)
Some checks failed
Build / Tests (gcc, gcov, Linux GCC, ubuntu-latest) (push) Failing after 6m19s
Build / Tests (llvm, llvm-cov gcov, Linux Clang, ubuntu-latest) (push) Failing after 6m28s
Build / documentation (push) Failing after 1m44s
CodeQL / Analyze (cpp) (push) Failing after 12s
Build / Tests (cl, Windows MSVC, windows-latest) (push) Has been cancelled
Build / Tests (llvm, llvm-cov gcov, MacOS clang, macos-latest) (push) Has been cancelled
Build / Create release (push) Has been cancelled
Build / Build packages (build/ftxui*Darwin*, macos-latest) (push) Has been cancelled
Build / Build packages (build/ftxui*Linux*, ubuntu-latest) (push) Has been cancelled
Build / Build packages (build/ftxui*Win64*, windows-latest) (push) Has been cancelled
Added -fPIC compile option.
2024-08-11 19:17:57 +02:00
5 changed files with 36 additions and 0 deletions

View File

@ -334,6 +334,7 @@ Feel free to add your projects here:
- [Caravan](https://github.com/r3w0p/caravan)
- [Step-Writer](https://github.com/BrianAnakPintar/step-writer)
- [XJ music](https://github.com/xjmusic/xjmusic)
- [UDP chat](https://github.com/Sergeydigl3/udp-chat-tui)
### [cpp-best-practices/game_jam](https://github.com/cpp-best-practices/game_jam)

View File

@ -49,6 +49,12 @@ function(ftxui_set_options library)
target_compile_options(${library} PUBLIC "/utf-8")
endif()
# CMake does automatically add -fPIC when linking a shared library, but it
# does not add it when linking a static library. This is a problem when the
# static library is later linked into a shared library.
# Doing it helps some users.
set_property(TARGET ${library} PROPERTY POSITION_INDEPENDENT_CODE ON)
# Add as many warning as possible:
if (WIN32)
if (MSVC)

View File

@ -38,6 +38,7 @@ class Table {
Table();
explicit Table(std::vector<std::vector<std::string>>);
explicit Table(std::vector<std::vector<Element>>);
Table(std::initializer_list<std::vector<std::string>> init);
TableSelection SelectAll();
TableSelection SelectCell(int column, int row);
TableSelection SelectRow(int row_index);

View File

@ -71,6 +71,22 @@ Table::Table(std::vector<std::vector<Element>> input) {
Initialize(std::move(input));
}
// @brief Create a table from a list of list of string.
// @param init The input data.
// @ingroup dom
Table::Table(std::initializer_list<std::vector<std::string>> init) {
std::vector<std::vector<Element>> input;
for (const auto& row : init) {
std::vector<Element> output_row;
output_row.reserve(row.size());
for (const auto& cell : row) {
output_row.push_back(text(cell));
}
input.push_back(std::move(output_row));
}
Initialize(std::move(input));
}
// private
void Table::Initialize(std::vector<std::vector<Element>> input) {
input_dim_y_ = static_cast<int>(input.size());

View File

@ -733,5 +733,17 @@ TEST(TableTest, Merge) {
screen.ToString());
}
TEST(TableTest, Issue912) {
Table({
{"a"},
});
Table({
{"a", "b"},
});
Table({
{"a", "b", "c"},
});
}
} // namespace ftxui
// NOLINTEND