Re: reformatting man pages at SIGWINCH

Ralph Corderoy
2023-04-08T11:40:19Z

Hi,

> > > (1) what part of the screen was the reader actually looking at?

less(1) has -j; that would be a good start.

> > > (2) how is the pager supposed to know how to map any given
> > > location on the screen back to a place in the unrendered source
> > > document so it can be accurately found when the document is
> > > rerendered?

I would assume the pager looks for the same place in its input, not in
the man-page source. It keeps seeking forward to the best matching run
of words, jumping to the best so far.

Problems I can think of:

- the formatter's input may be ephemeral and so need buffering,
- the originator may not have intended that and limited its size,
- seeking the best match after being WINCH'd must also buffer and may
never reach EOF,
- the input formatter may alter its output based on the terminal's size,
e.g. a pic(1) diagram disappears, and
- a solution which re-starts the pager loses the pager's ephemeral
settings.

I expect more would be found in practice.

--
Cheers, Ralph.