Changeset 3578 for trunk/payloads

Show
Ignore:
Timestamp:
09/12/08 23:50:57 (4 months ago)
Author:
stepan
Message:

* Implement scrolling in tinycurses
* Fix an off by one bug

Signed-off-by: Stefan Reinauer <stepan@…>
Acked-by: Jordan Crouse <jordan.crouse@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/payloads/libpayload/curses/tinycurses.c

    r3561 r3578  
    7171static int ldat_count = 0; 
    7272 
    73 /* One item bigger than SCREEN_X to reverse place for a NUL byte. */ 
     73/* One item bigger than SCREEN_X to reserve space for a NUL byte. */ 
    7474static NCURSES_CH_T linebuf_list[SCREEN_Y * MAX_WINDOWS][SCREEN_X + 1]; 
    7575static int linebuf_count = 0; 
     
    306306        // TODO: curscr, newscr? 
    307307 
    308         for (y = 0; y < stdscr->_maxy; y++) { 
    309                 for (x = 0; x < stdscr->_maxx; x++) { 
     308        for (y = 0; y <= stdscr->_maxy; y++) { 
     309                for (x = 0; x <= stdscr->_maxx; x++) { 
    310310                        stdscr->_line[y].text[x].chars[0] = ' '; 
    311311                        stdscr->_line[y].text[x].attr = A_NORMAL; 
     
    818818 
    819819        if (n != 0) { 
     820                int x, y; 
     821 
     822                for (y = 0; y <= (win->_maxy - n); y++) { 
     823                        for (x = 0; x <= win->_maxx; x++) { 
     824                                win->_line[y].text[x].chars[0] = win->_line[y + n].text[x].chars[0]; 
     825                                win->_line[y].text[x].attr = win->_line[y + n].text[x].attr; 
     826                        } 
     827                } 
     828 
     829                for (y = (win->_maxy+1 - n); y <= win->_maxy; y++) { 
     830                        for (x = 0; x <= win->_maxx; x++) { 
     831                                win->_line[y].text[x].chars[0] = ' '; 
     832                                win->_line[y].text[x].attr = A_NORMAL; 
     833                        } 
     834                } 
     835 
    820836                // _nc_scroll_window(win, n, win->_regtop, win->_regbottom, win->_nc_bkgd); 
    821837                // _nc_synchook(win);