问题
I'm trying to resize the terminal window I've been printing in with PDCurses. It only works sometimes. Otherwise it just sets itself to the default size, not even returning an error.
Examples of sizes that work:
resize_term(50, 50);
resize_term(100, 100);
resize_term(51, 100);
resize_term(50, 51);
resize_term(2, 60);
Examples of sizes that don't work:
resize_term(51, 51);
resize_term(51, 50);
resize_term(100, 51);
resize_term(60, 2);
Does anyone know why these certain ranges of sizes don't work?
(Also, bear in mind that resize_term takes the width as the second argument, not the first)
回答1:
I noticed that curses doesn't resize the terminal when it "thinks" it may go out of the bounds of the (physical, real world) screen.
Sorry for the lack of details, I don't know the underlying mechanics of this behaviour.
EDIT :
Here's a quote from the PDCurses documentation :
"resize_term() is effectively two functions: When called with nonzero values for nlines and ncols, it attempts to resize the screen to the given size.[...]"
Obviously emphasized on the "attempt", but it does not give any further information...
来源:https://stackoverflow.com/questions/14364041/pdcurses-resize-term-arbitrarily-fails-or-succeeds