问题
I'm learning how to use ncurses and I'm in a weird situation. It seems my output can't go over 24 lines. Moreover, whenever I run my software, and the execution finishes his job, my terminal stops working as before, and I have 2 different situations:
- if I've launched my run from a line behind line 24 I can use the terminal, but if I keep scrolling when at the last line of the window, nothing more happens: all input and output keep happening in the last line, without any new line appearing at enter pressure.
- if I've launched the run above line 24 the terminal will only become 24-lines high.
Both situations require me to reset the terminal, then everything works again. I'm on MAC OSX machine.
回答1:
There is a problem with the screen-size:
- The easiest one to see is if you has
LINES
environment variable set to 24. The use_env manpage gives some clues about that. - The reason why it sounds like a problem with screen-size is that the description of the problem suggests that the program is setting the scrolling region to 24 lines.
- If there is no problem with
LINES
, then a place to check is by runningstty -a
to see what the operating system supposes the screen-size to be. That is reported on the first line ofstty
's output as "rows". - In some cases (for instance in remote network connections), it is possible to have a session where the remote host cannot obtain the screen-size. As a workaround, you could run the resize program (an xterm utility) to update the operating system's notion of the screen-size.
By the way, your other question NCurses not restoring terminal behavior appears to be a duplicate of this. You should consolidate your questions into a single one which provides enough information for someone to offer useful information about the problem.
来源:https://stackoverflow.com/questions/29171442/ncurses-limited-output-size