Re: move_panel not working with pads
Thomas Dickey <[email protected]> Tue, 16 Jun 2026 16:49:53 -0400
| Newsgroups | gmane.comp.lib.ncurses.bugs |
|---|---|
| Message-ID | <[email protected]> |
--UfWJbNFeiQUA6flL
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Tue, Jun 16, 2026 at 08:11:08PM +0300, Giorgos Xou wrote:
> Why, though? PADs are WINDOWs, just special ones.
man newpad:
A curses pad is like a window, except that it is not restricted by =
the
screen size, and is not necessarily associated with a particular par=
t of
the screen. Pads can be used when a large window is needed, only =
part
of which is to be visible on the screen. Pads are not automatically=
re=E2=80=90
freshed by scrolling or input-echoing operations.
=20
man new_panel:
Panels are ncurses(3NCURSES) windows with the added property of de=
pth.
Panel functions allow the use of stacked windows and ensure that =
the
proper portions of each window and the curses stdscr window are hi=
dden
or displayed when panels are added, moved, modified, or removed. =
The
set of currently visible panels is the stack of panels. The stdscr =
win=E2=80=90
dow is beneath all panels, and is not considered part of the stack.
The panel library really wants to know how big (on the screen) and where
a window will be put when ncurses wants to repaint it. Those details are
set -- on each prefresh or pnoutrefresh call - by the calling application.
subpad creates a window in a pad. If there were a lot of panel & pad users,
it might be useful to provide a function that creates a pad in a window.
Having that, the way to put a pad in a panel would be this hypothetical
function -- leaving panel handling windows.
> On Tue, Jun 16, 2026 at 7:12=E2=80=AFPM Juergen Pfeifer <juergen@familiep=
feifer.de>
> wrote:
>=20
> > IMHO the panel library should be modified to return an error if one tri=
es
> > to wrap a PAD with a PANEL. PANELs are/were intended for WINDOWs.
> >
> > J=C3=BCrgen
> >
> > Am 16.06.2026 um 04:43 schrieb Giorgos Xou <[email protected]>:
> >
> > =EF=BB=BF
> >
> >
> > ---------- Forwarded message ---------
> > From: Giorgos Xou <[email protected]>
> > Date: Tue, Jun 16, 2026 at 4:35=E2=80=AFAM
> > Subject: Re: move_panel not working with pads
> > To: Thomas Dickey <[email protected]>
> >
> >
> > On Mon, Jun 15, 2026 at 07:11:11PM -0400, Thomas Dickey wrote:
> > > On Mon, Jun 15, 2026 at 06:12:27PM -0400, Bill Gray wrote:
> > > > On 6/15/26 16:56, Thomas Dickey wrote:
> > > > > On Mon, Jun 15, 2026 at 02:57:45PM -0400, Bill Gray wrote:
> > > > > > Hmmm... please post the test code you're using for this? H=
ave
> > you tried
> > > > > > it with PDCursesMod? (Its panel library is a near-total rewrit=
e,
> > but its
> > > > > > move_panel() does use mvwin() internally.)
> >
> > No, I haven't tested it against PDCursesMod nor PDCurses, it was just a
> > speculation
> > considering it uses mvwin internally too.
> >
> >
> > > > >
> > > > > yes... a test-program is needed to see how it compares with the
> > > > > various implementations :-)
> >
> > Here's a simple test-program i guess :-D
> >
> > ```
> > #include <curses.h>
> > #include <panel.h>
> >
> >
> > int main( void)
> > {
> > int ch =3D -1;
> > int y =3D 0, x =3D 0;
> > WINDOW *pad1;
> > PANEL *panel1;
> >
> > initscr ();
> > noecho ();
> > start_color();
> >
> > init_pair(1, COLOR_BLUE, COLOR_RED);
> > keypad(stdscr, TRUE);
> >
> > refresh();
> >
> > pad1 =3D newpad(10,10);
> >
> > wbkgd (pad1, COLOR_PAIR(1));
> > waddstr (pad1,"Test.");
> > prefresh(pad1, 0, 0, 1, 2, 4 , 9);
> >
> > panel1 =3D new_panel(pad1);
> >
> > while(ch !=3D 'q' && ch !=3D 'Q')
> > {
> > ch =3D getch();
> >
> > if (ch =3D=3D KEY_UP ) ++y;
> > else if (ch =3D=3D KEY_DOWN ) --y;
> > else if (ch =3D=3D KEY_RIGHT) ++x;
> > else if (ch =3D=3D KEY_LEFT ) --x;
> >
> > move_panel(panel1, y, x);
> > update_panels();
> > }
> > endwin( );
> > return(0);
> > }
> > ```
> >
> > > >
> > > > It occurs to me to wonder : is the panel library warranteed to w=
ork
> > if
> > > > you feed it a pad (or subpad or sub-window) instead of a plain old
> > window?
> > > > I've never tried it.
> >
> > Had the same thoughts, never tried it too.
> >
> > > >
> > > > Is there a use case for calling new_panel( ) with a pad?
> >
> > Pads are really useful with anything involving scrollable text (such as
> > logs, lists, fancy-tuifimanager stuff etc.).
> >
> > As you already know, the main appeal of panels is the fact that they
> > solve the flickering issue of stacked windows in a more elegant way
> > than manually doing so.
> >
> > Therefore pads with panels are practically useful for anything that
> > already previously involved plain old stacked-windows but with
> > too-much text.
> >
> > A few practical examples I can think of using pads with panels are
> > thinks like:
> > - https://www.reddit.com/r/neovim/comments/1u49mnw/
> > - https://www.reddit.com/r/commandline/comments/1tbfeua/
> > - https://github.com/reekta92/graf
> > - plus, fancy modern-TUI animations?
> >
> >
> > >
> > > maybe - but pads differ from windows by being more readily movable
> > >
> > > >
> > > > -- Bill
> > > >
> > > > > > -- Bill
> > > > > >
> > > > > > On 6/15/26 14:20, Giorgos Xou wrote:
> > > > > > > move_panel internally uses mvwin, which doesn't work with pads
> > (pdcurses
> > > > > > > seems to be affected by this as well). Maybe pnoutrefresh cou=
ld
> > be used
> > > > > > > internally for that specific case or some kind of an alternat=
ive
> > new
> > > > > > > mvpad function?
> > > > > > >
> > > > > > > (It just happened that I was again looking deep into how pane=
ls
> > work
> > > > > > > internally and just happened to stumble upon this issue.)
> > > > > > >
> > > > > > > *Cross-refs: *
> > > > > > > 3. ncurses 6.3 - patch 20211106 <
> > https://github.com/mirror/ncurses/commit/f399f54c6c4ea2143afcbf704ce9af=
0be52b63fc
> > >
> > > > > > > 2. hide_panel/show_panel not working with pads.
> > > > > > > <
> > https://lists.gnu.org/archive/html/bug-ncurses/2021-10/msg00037.html>
> > > > > > > 1. https://github.com/wmcbrine/PDCurses/issues/124
> > > > > > > <https://github.com/wmcbrine/PDCurses/issues/124>
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > > --
> > > Thomas E. Dickey <[email protected]>
> > > https://invisible-island.net
> >
> >
> > PS. For some reason html "reply via email to" didn't work and I had to
> > figure out how (this cool thing that is called) neomutt works. so I've
> > no idea how this mail will be sent or if it actually was sent
> > correctly.
> >
> >
--=20
Thomas E. Dickey <[email protected]>
https://invisible-island.net
--UfWJbNFeiQUA6flL
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQGzBAABCgAdFiEEGYgtkt2kxADCLA1WzCr0RyFnvgMFAmoxtu0ACgkQzCr0RyFn
vgOwwAwA5Q7z5FU6g00b1UYboV+VluTqwq/PHKMcZg3rh1VA88nv3CX285nLiGMw
noieRL+4oeaCLqy97W/O4w8npgK9M0Ul1gPbu6anIGYQE6rD4AS/OYVJgoZpf2NJ
6Y9X3fOWsyP3nfqvo/X+vOWCWSLMBnpZreHh6ybJ9TF4CupsKJGPcb3hWFSrn7jF
R/auu/m66jdmmju2Pn9tg30kWy5ZoniSp1STYnTl1VOi54HhuK2tiH41eyFHV4Xf
E7m+InsxgoCUPX6vsHpc3TbcsnoBV/ccC2YF/H8ub2dPKx+M00uVkqalwOZj4Uua
vYUXuZ+WrUsAZm+N35zqOq/2vMCrTrn4Z7dZpTvMPxHSd5LKoWe73rcTtVHjf//n
PP90ZOgLnDIO3zmMh29cJGkWHMsFUCvfeM7m3KQNrGEUh+prh32xIYF1I+bndIS5
kyT1rzb6Yz2nwO1c6Gl8BwhOv027GPlfd8N2lHRwdNxiUTQJuHEYeOl1UMyLAqvS
4K6WxdUo
=4tIh
-----END PGP SIGNATURE-----
--UfWJbNFeiQUA6flL--