On Thu, Feb 05, 2026 at 11:59:33AM +0000, Robin Haberkorn via Bug reports for 
ncurses, the GNU implementation of curses wrote:
> On Tue Feb 3, 2026 at 20:52:53 GMT +01, G. Branden Robinson wrote:
> > At 2026-02-03T19:33:19+0000, Robin Haberkorn wrote:
> >> Perhaps I will build against a debug version of ncurses
> >> and step through with GDB, looking for the place actually
> >> preventing configuration of the scroll region.
> >
> > This would seem to be the relevant code:
> >
> > https://github.com/ThomasDickey/ncurses-snapshots/blob/dd63e6cc22ddea3df663b977891aedd5b918e310/ncurses/tty/tty_update.c#L1800
> >
> > It appears to me that if the terminal description has the
> > change_scroll_region (csr) capability, ncurses will use it.
> 
> He actually went through all of this. I saw that csr was emitted with the
> correct top and bottom lines and scroll_forward. Still, it did not scroll
> within the scroll region. More strangely, it ended up correctly drawing the
> screen (after scrolling the entire screen). No idea why. I did set idlok() on
> stdscr and the window in question that should be scrolled. Perhaps it is a
> bug in the vt100 terminfo entry. But hardly. I should try to get that
> scrolling to work in a script with tput. If it's really worth all the
> effort...
> 
> The real motivation is that since I enabled the hardware cursor (curs_set(1))
> in my application, I start to see the cursor jumping across the screen
> on redraws in slow terminal emulators. Disabling the cursor around refresh()/
> doupdate() causes other visual glitches. So I thought I'd optimize the
> screen output a bit more - when scrolling in the editor, there is no need to
> redraw the entire screen.

ncurses compares all rows on the screen, finds the first/last column on each
row to see where to change things.  A scrolling region may/may not be used
depending on what's changed.

Rather than stepping through with the debugger, you can build it using
the "--with-trace" option and get a library that you can make trace files.
(man curses_trace).

-- 
Thomas E. Dickey <[email protected]>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to