Fix cursor position for dom.

This commit is contained in:
Arthur Sonzogni 2019-01-06 22:45:10 +01:00
parent acc7012f58
commit e6614d6363
3 changed files with 3 additions and 2 deletions

View File

@ -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;

View File

@ -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());

View File

@ -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();
}