Ncurses Scrolling Text Reader

I need to implement a simple text reader, sort of less for unix using ncurses.

I am having trouble understanding how to do this. I currently have a window, and every time I press the down key (for example), I update all the lines at the corresponding starting point, giving it a scroll feel. The problem is with text wrapping, which unfortunately twists my current system.

I was wondering if some of you have already done something similar and can help me. I frankly can't find anything like this on Google except the "pad", which apparently doesn't scroll.

+3
source share
1 answer
   int prefresh(WINDOW *pad, int pminrow, int pmincol,
         int sminrow, int smincol, int smaxrow, int smaxcol);

prefresh 2nd and 3rd parameters are the values โ€‹โ€‹of its positioning. With a little math, you can increase / decrease pminrow for the vertical scroll effect.

+4
source

Source: https://habr.com/ru/post/1713010/


All Articles