notcurses icon indicating copy to clipboard operation
notcurses copied to clipboard

ncplane_puttext causes infinite plane resizing

Open lokxii opened this issue 11 months ago • 7 comments

I have this following code that causes the problem

int main() {
    setlocale(LC_ALL, "");
    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);
    ncplane_options testplane_opt = {
        .rows = 1,
        .cols = 48,
        .flags = NCPLANE_OPTION_AUTOGROW | NCPLANE_OPTION_VSCROLL
    };
    ncplane* n = ncplane_create(stdplane, &testplane_opt);
    std::string text = "おなかがすいたし眠いのでナイトシティに帰ります\n私は最寄駅のことをナイトシティと2分前から呼んでいます";
    float cols = ncplane_puttext(
        n, 0, NCALIGN_LEFT, text.c_str(), NULL);

    notcurses_render(nc);

    ncinput ni;
    while (notcurses_get_blocking(nc, &ni) == -1 || ni.id == 27) {}
    notcurses_stop(nc);

    return 0;
}

I am using notcurses just compiled from latest commit on master branch, an Kitty terminal v0.31.0 When I remove the number 2 from the string, ncplane_puttext prints the string properly.

lokxii avatar Mar 24 '24 09:03 lokxii