At 2026-02-03T18:33:28+0000, Robin Haberkorn via Bug reports for ncurses, the 
GNU implementation of curses wrote:
> Hello ncurses users!
> 
> When running my program (it's a text editor) in a VT100 emulator,

Which VT100 emulator is it, and how good is it known to be?

"VT100" is the most emulated terminal type in the world, and
unfortunately the people who've written emulators for it have been
largely indifferent to the behavior of the actual device.  I suspect
more than a few of them didn't realize that "VT100" referred to an
actual hardware device manufactured by DEC.  They simply recognized the
name from Procomm Plus or Tera Term or whatever.

They resemble the people who write terminal emulators for graphical
display environments, and tell their users to prefix `TERM` with
"xterm-", because that way their emulator will "work".  They're in a
hurry to take over the world and don't have time to compose a terminfo
description of their program or instruct their users how to install it.

> I notice that ncurses causes a hardware scroll of the entire screen
> whenever I scroll my text area. I do have an info line above,
> a message line and command line below the main text area.
> So it's not using the VT100's hardware scroll regions (csr) yet.
> And that's probably wasting bandwith on many other terminal
> emulators as well.
> 
> I guess I must first idlok() on the window that should be scrolled.

There's a story behind idlok().

outopts(3NCURSES):
...
DESCRIPTION
     These functions configure properties of curses windows that affect
     their manner of output.  Boolean‐valued properties are initially
     FALSE except where noted.  endwin(3NCURSES) resets any terminal
     modes corresponding to these properties; an application need not
     restore their initial values.
...
   idlok
     Setting win’s idlok property to TRUE causes curses to consider
     using the insert/delete line capabilities of terminal types
     possessing them according to the terminfo database.  Enable this
     option if the application explicitly requires these operations, as
     a full‐screen text editor might; otherwise the results may be
     visually annoying to the user.
...
PORTABILITY
...
     Early System V curses implementations specified that with scrollok
     enabled, any window modification triggering a scroll also forced a
     physical refresh.  X/Open Curses does not require this, and ncurses
     avoids doing so to better optimize vertical motions upon a
     wrefresh.
...

> Do I __have to__ use scrollok() as well?

outopts(3NCURSES):
...
   scrollok
     The scrollok option controls what happens when a window’s cursor
     moves off the edge of the window or scrolling region, as a result
     of either (1) writing a newline anywhere on its bottom line, or (2)
     writing a character that advances the cursor to the last position
     on its bottom line.  If disabled (bf is FALSE), curses leaves the
     cursor on the bottom line of the window.  If enabled (bf is TRUE),
     curses scrolls the window up one line.  (To get the physical
     scrolling effect on the terminal, the application must also enable
     idlok).
...

scrollok() is not documented to have anything to do with hardware
scrolling regions.  However, in the ncurses "NEWS" for 1.8.9 (~30 years
ago), I see:

* vertical-movement optimization now uses hardware scrolling, il, dl.

So _if_ ncurses's/terminfo's "vt100" terminal description accurate
records hardware scrolling capabilities _and_ the VT100 emulator
_correctly_ implements those capabilities, I'd expect it to work.

> Does it have to be enabled on stdscr as well?

Since all of the output option functions take `win *` arguments, I'd
assume they have to be configured for every window your application
uses, if the default does not satisfy.

This is the best of my understanding.  I'd throw your VT100 terminal
emulator at "vttest" and/or "tack" before assuming that your editor can
interact with it as if it really were a VT100 terminal.

https://invisible-island.net/vttest/
https://invisible-island.net/ncurses/tack.html

Regards,
Branden

Attachment: signature.asc
Description: PGP signature

Reply via email to