PDCurses scrolling issue

Whenever I need a large data output in a console I just use setconsolescreenbuffersize() so I can always scroll back if amount of data exceeds the size of console.

However, when using pdcurses I can't seem to make it so a window remembers its contents. If I set it to be scrollable and try to scroll back I get empty lines. I've looked at WINDOW data structure and haven't found anything resembling data buffer. Do I have to code a buffer for curses window myself?

Here is an example program. It creates a pad, prints numbers from 1 to 100 and after that is supposed to scroll back to number one. However, instead of numbers there is simply nothing.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <Windows.h>
#include <curses.h>

int main()
{
        WINDOW  *w;
        int     i;

        if (initscr() != NULL)
	{
                if ((w = newpad(25,80)) != NULL) 
		{
                        scrollok(w,TRUE);
                        for (i = 1 ; i <= 100 ; i++) 
			{
				Sleep (50);
                                wprintw(w,"%d\n",i);
                                prefresh(w,0,0,0,0,24,79);
                        }
						while (true)
						{
							Sleep (50);
							wscrl (w, -1);
							prefresh(w,0,0,0,0,24,79);
						}
                }
                endwin();
        }
        return 0;
}
Last edited on
Topic archived. No new replies allowed.