mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-28 22:26:28 +08:00
Compare commits
4 Commits
1871efc8ba
...
d69f4ff128
Author | SHA1 | Date | |
---|---|---|---|
|
d69f4ff128 | ||
|
535290bb3b | ||
|
fcd050c017 | ||
|
d7de24cd9e |
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
@ -733,5 +733,17 @@ TEST(TableTest, Merge) {
|
||||
screen.ToString());
|
||||
}
|
||||
|
||||
TEST(TableTest, Issue912) {
|
||||
Table({
|
||||
{"a"},
|
||||
});
|
||||
Table({
|
||||
{"a", "b"},
|
||||
});
|
||||
Table({
|
||||
{"a", "b", "c"},
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
Loading…
Reference in New Issue
Block a user