Fwd: move_panel not working with pads

Giorgos Xou <[email protected]> Tue, 16 Jun 2026 05:42:46 +0300
Newsgroups gmane.comp.lib.ncurses.bugs
Message-ID <CAG9dOf_tncsu5NH=GdDVGESu6Aw-xfOaKfThfJx3A0MdfEwQGQ@mail.gmail.com>
--0000000000009db7d5065455e689
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

---------- 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?  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 =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 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/f399f54c6c4ea2143afcbf704ce9af0be5=
2b63fc
>
> > > > > 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.

--0000000000009db7d5065455e689
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote gmail_quote_container"><=
div dir=3D"ltr" class=3D"gmail_attr">---------- Forwarded message ---------=
<br>From: <strong class=3D"gmail_sendername" dir=3D"auto">Giorgos Xou</stro=
ng> <span dir=3D"auto">&lt;<a href=3D"mailto:[email protected]">gxousos@gma=
il.com</a>&gt;</span><br>Date: Tue, Jun 16, 2026 at 4:35=E2=80=AFAM<br>Subj=
ect: Re: move_panel not working with pads<br>To: Thomas Dickey &lt;<a href=
=3D"mailto:[email protected]">[email protected]</a>&gt;=
<br></div><br><br>On Mon, Jun 15, 2026 at 07:11:11PM -0400, Thomas Dickey w=
rote:<br>
&gt; On Mon, Jun 15, 2026 at 06:12:27PM -0400, Bill Gray wrote:<br>
&gt; &gt; On 6/15/26 16:56, Thomas Dickey wrote:<br>
&gt; &gt; &gt; On Mon, Jun 15, 2026 at 02:57:45PM -0400, Bill Gray wrote:<b=
r>
&gt; &gt; &gt; &gt;=C2=A0 =C2=A0 =C2=A0Hmmm... please post the test code yo=
u&#39;re using for this?=C2=A0 Have you tried<br>
&gt; &gt; &gt; &gt; it with PDCursesMod?=C2=A0 (Its panel library is a near=
-total rewrite, but its<br>
&gt; &gt; &gt; &gt; move_panel() does use mvwin() internally.)<br>
<br>
No, I haven&#39;t tested it against PDCursesMod nor PDCurses, it was just a=
 speculation<br>
considering it uses mvwin internally too.<br>
<br>
<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; yes... a test-program is needed to see how it compares with =
the<br>
&gt; &gt; &gt; various implementations :-)<br>
<br>
Here&#39;s a simple test-program i guess :-D<br>
<br>
```<br>
=C2=A0 =C2=A0 #include &lt;curses.h&gt;<br>
=C2=A0 =C2=A0 #include &lt;panel.h&gt;<br>
<br>
<br>
=C2=A0 =C2=A0 int main( void)<br>
=C2=A0 =C2=A0 {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 int ch =3D -1;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 int y =3D 0, x =3D 0;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 WINDOW *pad1;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 PANEL=C2=A0 *panel1;<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 initscr=C2=A0 =C2=A0 ();<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 noecho=C2=A0 =C2=A0 =C2=A0();<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 start_color();<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 init_pair(1, COLOR_BLUE, COLOR_RED);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 keypad(stdscr, TRUE);<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 refresh();<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 pad1 =3D newpad(10,10);<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 wbkgd=C2=A0 =C2=A0(pad1, COLOR_PAIR(1));<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 waddstr (pad1,&quot;Test.&quot;);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 prefresh(pad1, 0, 0, 1, 2, 4 , 9);<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 panel1 =3D new_panel(pad1);<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 while(ch !=3D &#39;q&#39; &amp;&amp; ch !=3D &#=
39;Q&#39;)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ch =3D getch();<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if=C2=A0 =C2=A0 =C2=A0 (ch =3D=3D=
 KEY_UP=C2=A0 =C2=A0) ++y;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else if (ch =3D=3D KEY_DOWN ) --y=
; <br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else if (ch =3D=3D KEY_RIGHT) ++x=
; <br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else if (ch =3D=3D KEY_LEFT ) --x=
; <br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 move_panel(panel1, y, x);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 update_panels();<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 endwin( );<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return(0);<br>
=C2=A0 =C2=A0 }<br>
```<br>
<br>
&gt; &gt; <br>
&gt; &gt;=C2=A0 =C2=A0 It occurs to me to wonder : is the panel library war=
ranteed to work if<br>
&gt; &gt; you feed it a pad (or subpad or sub-window) instead of a plain ol=
d window?<br>
&gt; &gt; I&#39;ve never tried it.<br>
<br>
Had the same thoughts, never tried it too.<br>
<br>
&gt; &gt; <br>
&gt; &gt;=C2=A0 =C2=A0 Is there a use case for calling new_panel( ) with a =
pad?<br>
<br>
Pads are really useful with anything involving scrollable text (such as<br>
logs, lists, fancy-tuifimanager stuff etc.). <br>
<br>
As you already know, the main appeal of panels is the fact that they <br>
solve the flickering issue of stacked windows in a more elegant way <br>
than manually doing so. <br>
<br>
Therefore pads with panels are practically useful for anything that<br>
already previously involved plain old stacked-windows but with <br>
too-much text.<br>
<br>
A few practical examples I can think of using pads with panels are<br>
thinks like:<br>
- <a href=3D"https://www.reddit.com/r/neovim/comments/1u49mnw/" rel=3D"nore=
ferrer" target=3D"_blank">https://www.reddit.com/r/neovim/comments/1u49mnw/=
</a><br>
- <a href=3D"https://www.reddit.com/r/commandline/comments/1tbfeua/" rel=3D=
"noreferrer" target=3D"_blank">https://www.reddit.com/r/commandline/comment=
s/1tbfeua/</a><br>
- <a href=3D"https://github.com/reekta92/graf" rel=3D"noreferrer" target=3D=
"_blank">https://github.com/reekta92/graf</a><br>
- plus, fancy modern-TUI animations?<br>
<br>
<br>
&gt; <br>
&gt; maybe - but pads differ from windows by being more readily movable<br>
&gt; <br>
&gt; &gt; <br>
&gt; &gt; -- Bill<br>
&gt; &gt; <br>
&gt; &gt; &gt; &gt; -- Bill<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; On 6/15/26 14:20, Giorgos Xou wrote:<br>
&gt; &gt; &gt; &gt; &gt; move_panel internally uses mvwin, which doesn&#39;=
t work with pads (pdcurses<br>
&gt; &gt; &gt; &gt; &gt; seems to be affected by this as well). Maybe pnout=
refresh=C2=A0could be used<br>
&gt; &gt; &gt; &gt; &gt; internally for that specific case or some kind of =
an alternative new<br>
&gt; &gt; &gt; &gt; &gt; mvpad function?<br>
&gt; &gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; &gt; (It just happened that I was again looking deep=C2=
=A0into how panels work<br>
&gt; &gt; &gt; &gt; &gt; internally and just happened to stumble upon=C2=A0=
this issue.)<br>
&gt; &gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; &gt; *Cross-refs: *<br>
&gt; &gt; &gt; &gt; &gt; 3. ncurses 6.3 - patch 20211106 &lt;<a href=3D"htt=
ps://github.com/mirror/ncurses/commit/f399f54c6c4ea2143afcbf704ce9af0be52b6=
3fc" rel=3D"noreferrer" target=3D"_blank">https://github.com/mirror/ncurses=
/commit/f399f54c6c4ea2143afcbf704ce9af0be52b63fc</a>&gt;<br>
&gt; &gt; &gt; &gt; &gt; 2. hide_panel/show_panel not working with pads.<br=
>
&gt; &gt; &gt; &gt; &gt; &lt;<a href=3D"https://lists.gnu.org/archive/html/=
bug-ncurses/2021-10/msg00037.html" rel=3D"noreferrer" target=3D"_blank">htt=
ps://lists.gnu.org/archive/html/bug-ncurses/2021-10/msg00037.html</a>&gt;<b=
r>
&gt; &gt; &gt; &gt; &gt; 1. <a href=3D"https://github.com/wmcbrine/PDCurses=
/issues/124" rel=3D"noreferrer" target=3D"_blank">https://github.com/wmcbri=
ne/PDCurses/issues/124</a><br>
&gt; &gt; &gt; &gt; &gt; &lt;<a href=3D"https://github.com/wmcbrine/PDCurse=
s/issues/124" rel=3D"noreferrer" target=3D"_blank">https://github.com/wmcbr=
ine/PDCurses/issues/124</a>&gt;<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; <br>
&gt; &gt; <br>
&gt; <br>
&gt; -- <br>
&gt; Thomas E. Dickey &lt;<a href=3D"mailto:[email protected]" ta=
rget=3D"_blank">[email protected]</a>&gt;<br>
&gt; <a href=3D"https://invisible-island.net" rel=3D"noreferrer" target=3D"=
_blank">https://invisible-island.net</a><br>
<br>
<br>
PS. For some reason html &quot;reply via email to&quot; didn&#39;t work and=
 I had to <br>
figure out how (this cool thing that is called) neomutt works. so I&#39;ve<=
br>
no idea how this mail will be sent or if it actually was sent <br>
correctly.<br>
</div></div>

--0000000000009db7d5065455e689--