bsddialog(3): Fix text wrapping
Fix text wrapping with more than 1024 words. Reported by: brd Reviewed by: bapt, brd Differential Revision: https://reviews.freebsd.org/D35413
This commit is contained in:
parent
ad52a7bb03
commit
559de8eedb
@ -443,9 +443,10 @@ text_autosize(struct bsddialog_conf *conf, const char *text, int maxrows,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nword + tablen >= maxwords) {
|
||||
if (nword + tablen + 1 >= maxwords) {
|
||||
maxwords += 1024;
|
||||
if (realloc(words, maxwords * sizeof(int)) == NULL)
|
||||
words = realloc(words, maxwords * sizeof(int));
|
||||
if (words == NULL)
|
||||
RETURN_ERROR("Cannot realloc memory for text "
|
||||
"autosize");
|
||||
}
|
||||
@ -968,4 +969,4 @@ end_dialog(struct bsddialog_conf *conf, WINDOW *shadow, WINDOW *widget,
|
||||
*conf->get_height = h;
|
||||
if (conf->get_width != NULL)
|
||||
*conf->get_width = w;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user