diff --git a/ftxui/src/ftxui/dom/vbox.cpp b/ftxui/src/ftxui/dom/vbox.cpp index ab2e2b7..1ad9896 100644 --- a/ftxui/src/ftxui/dom/vbox.cpp +++ b/ftxui/src/ftxui/dom/vbox.cpp @@ -51,7 +51,7 @@ class VBox : public Node { remaining_flex -= child->requirement().flex.y; child_box.bottom += added_space; } - child_box.bottom = std::min(child_box.bottom, box.bottom); + child_box.bottom = std::min(child_box.bottom, box.bottom-1); child->SetBox(child_box); y = child_box.bottom + 1; diff --git a/ftxui/src/ftxui/dom/vbox_test.cpp b/ftxui/src/ftxui/dom/vbox_test.cpp index 1ac7d39..aabaaa6 100644 --- a/ftxui/src/ftxui/dom/vbox_test.cpp +++ b/ftxui/src/ftxui/dom/vbox_test.cpp @@ -46,7 +46,7 @@ TEST(VBoxTest, ScreenSmaller1Flex) { TEST(VBoxTest, ScreenFitFlex) { auto root = vbox(text(L"text_1"), filler(), text(L"text_2")); - Screen screen(6, 2); + Screen screen(15, 10); Render(screen, root.get()); EXPECT_EQ("text_1\ntext_2", screen.ToString()); diff --git a/ftxui/src/ftxui/screen/screen.cpp b/ftxui/src/ftxui/screen/screen.cpp index 30f0bfb..3c5abd9 100644 --- a/ftxui/src/ftxui/screen/screen.cpp +++ b/ftxui/src/ftxui/screen/screen.cpp @@ -96,6 +96,7 @@ std::string Screen::ResetPosition() { for (size_t y = 1; y < dimy_; ++y) { ss << "\e[2K\r\e[1A"; } + ss << '\r'; return ss.str(); }