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 part 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‐
       freshed by scrolling or input-echoing operations.
 
man new_panel:

       Panels  are  ncurses(3NCURSES) windows with the added property of depth.
       Panel functions allow the use of stacked windows  and  ensure  that  the
       proper  portions  of each window and the curses stdscr window are hidden
       or displayed when panels are added, moved, modified,  or  removed.   The
       set of currently visible panels is the stack of panels.  The stdscr win‐
       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 PM Juergen Pfeifer <[email protected]>
> wrote:
> 
> > IMHO the panel library should be modified to return an error if one tries
> > to wrap a PAD with a PANEL. PANELs are/were intended for WINDOWs.
> >
> > Jürgen
> >
> > Am 16.06.2026 um 04:43 schrieb Giorgos Xou <[email protected]>:
> >
> > 
> >
> >
> > ---------- Forwarded message ---------
> > From: Giorgos Xou <[email protected]>
> > Date: Tue, Jun 16, 2026 at 4:35 AM
> > 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?  Have
> > you tried
> > > > > > it with PDCursesMod?  (Its panel library is a near-total rewrite,
> > 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 = -1;
> >         int y = 0, x = 0;
> >         WINDOW *pad1;
> >         PANEL  *panel1;
> >
> >         initscr    ();
> >         noecho     ();
> >         start_color();
> >
> >         init_pair(1, COLOR_BLUE, COLOR_RED);
> >         keypad(stdscr, TRUE);
> >
> >         refresh();
> >
> >         pad1 = newpad(10,10);
> >
> >         wbkgd   (pad1, COLOR_PAIR(1));
> >         waddstr (pad1,"Test.");
> >         prefresh(pad1, 0, 0, 1, 2, 4 , 9);
> >
> >         panel1 = new_panel(pad1);
> >
> >         while(ch != 'q' && ch != 'Q')
> >         {
> >             ch = getch();
> >
> >             if      (ch == KEY_UP   ) ++y;
> >             else if (ch == KEY_DOWN ) --y;
> >             else if (ch == KEY_RIGHT) ++x;
> >             else if (ch == 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 work
> > 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 could
> > be used
> > > > > > > internally for that specific case or some kind of an alternative
> > new
> > > > > > > mvpad function?
> > > > > > >
> > > > > > > (It just happened that I was again looking deep into how panels
> > work
> > > > > > > internally and just happened to stumble upon this issue.)
> > > > > > >
> > > > > > > *Cross-refs: *
> > > > > > > 3. ncurses 6.3 - patch 20211106 <
> > https://github.com/mirror/ncurses/commit/f399f54c6c4ea2143afcbf704ce9af0be52b63fc
> > >
> > > > > > > 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.
> >
> >

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

Attachment: signature.asc
Description: PGP signature

Reply via email to