mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-18 09:08:08 +08:00
Fix focus vs flexbox interaction. (#405)
- Fix focus in flexbox. This required resetting the focus state at the beginning of the ComputeRequirement(), because it can now run several times. This resolves:https://github.com/ArthurSonzogni/FTXUI/issues/399 - Add Box::Union. - Add a preliminary implementation of forwarding selected_box from within the flexbox.
This commit is contained in:
@@ -432,6 +432,29 @@ TEST(FlexboxTest, GapY) {
|
||||
" ");
|
||||
}
|
||||
|
||||
TEST(FlexboxTest, Focus) {
|
||||
auto document = vbox({
|
||||
paragraph("0 -"),
|
||||
paragraph("1 -"),
|
||||
paragraph("2 -"),
|
||||
paragraph("3 -"),
|
||||
paragraph("4 -"),
|
||||
paragraph("5 -"),
|
||||
paragraph("6 -"),
|
||||
paragraph("7 -") | focus,
|
||||
paragraph("8 -"),
|
||||
paragraph("9 -"),
|
||||
}) | yframe | flex;
|
||||
|
||||
Screen screen(1, 3);
|
||||
Render(screen, document);
|
||||
EXPECT_EQ(screen.ToString(),
|
||||
"7\r\n"
|
||||
"-\r\n"
|
||||
"8"
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||
|
Reference in New Issue
Block a user