scrolling content in ncurses box

10,516

Use the scrollok(WINDOW *win, bool bf); function.

scrollok(win, TRUE);

From the man page:

The scrollok option controls what happens when the cursor of a window is moved off the edge of the window or scrolling region, either as a result of a newline action on the bottom line, or typing the last character of the last line. If disabled, (bf is FALSE), the cursor is left on the bottom line. If enabled, (bf is TRUE), the window is scrolled up one line (Note that to get the physical scrolling effect on the terminal, it is also necessary to call idlok).


btw, I've written a very simple interface to an irc client in c using ncurses (pic), it is not complete, but you may want to peek for hints - code.

Share:
10,516
user1340098
Author by

user1340098

Updated on June 04, 2022

Comments

  • user1340098
    user1340098 about 2 years

    I have a window (created with newwin ) and create box (box (WINDOW *, int, int) ).

    I read and write (on FD 0 and 1) under the box, and I get a (char *) from a socket, I wrote this tab in the box.

    When I wrote 195 lines, I arrive on the end of the box.

    How I can scroll the existing text, so that new text will print at the bottom?

  • user1340098
    user1340098 about 12 years
    well i'll try scrollok. > (i don't find a good reference for NCurse, have you got one ?) thank you for you code, but is not very hard so i 'll not use it, But thank you !