dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.56k stars 112 forks source link

parent not updating dimension when child forces parent to grow #2774

Open lokxii opened 5 months ago

lokxii commented 5 months ago

Consider the following code

#include <iostream>
#include <notcurses/notcurses.h>

int main() {
    notcurses* nc = NULL;
    notcurses_options opt = {
        .loglevel = NCLOGLEVEL_TRACE,
        .flags = NCOPTION_NO_QUIT_SIGHANDLERS | NCOPTION_SUPPRESS_BANNERS
    };
    if ((nc = notcurses_init(&opt, NULL)) == NULL) {
        exit(EXIT_FAILURE);
    }
    ncplane* stdplane = notcurses_stdplane(nc);

    unsigned int cols = 30;
    ncplane_options opt2 = {
        .y = 0,
        .x = 0,
        .rows = 1,
        .cols = cols,
        .flags = NCPLANE_OPTION_AUTOGROW | NCPLANE_OPTION_VSCROLL,
    };
    ncplane* parent = ncplane_create(stdplane, &opt2);

    ncplane_options opt3 = {
        .y = 0,
        .x = 0,
        .rows = 30,
        .cols = cols,
    };
    ncplane* child = ncplane_create(parent, &opt3);
    auto d = ncplane_dim_y(parent);

    notcurses_stop(nc);

    std::cout << d << std::endl;
}

A parent plane is created with one row. Then a child plane is created with 30 rows. I would expect the parent plane to grow to have 30 rows, but d turns out to be 1. Is the parent plane not growing or is it not updating the dimension information?

lokxii commented 5 months ago

Actually I am not even sure what was the intended behaviour