I have been experimenting with the DECSTBM escape sequence in xterm (v353). Although generally working, I had one issue:
I would set the scrolling region to one line less than the window height. When viewing files with less (or the man), it would print lines inside the scroll region, but it generates one line more than would fit. When scrolling back up the status line slips outside the scroll region and scrolling generally seems to break.
Another example is the 'more' completion prompt from readline (bash), it would print as many lines as the window size reports, in my case scrolling the first line off screen.
By digging through code I found that less seems to ask the system directly for window size (using ioctl), therefore bypassing size given by environment variables COLUMNS or LINES. Is there a way to communicate the available scroll region instead of the window size to programs querying the terminal size?
stty rows 25
; it will set the value returned byioctl(TIOCGWINSZ)
until you resize the terminal window.stty rows <num>
gives me what I want. Can you post this as answer?