int main(void) { int y,x,c,halfy; initscr(); getmaxyx(stdscr,y,x); halfy = y >> 1; for(c=0;c<y;c++) mvprintw(c,15,"This is amazing row %d!\n",c); refresh(); getch(); move(halfy,0); for(c=0;c<halfy;c++) { insdelln(1); refresh(); napms(100); } move(0,0); for(c=0;c<halfy;c++) { insdelln(-1); refresh(); napms(100); } endwin(); return 0; }
static void test_insdelln(void) { STATUS st; int n; init_status(stdscr, &st); do { (void) attrset(st.attr | COLOR_PAIR(st.pair)); switch (st.ch) { case 'i': for (n = 0; n < st.count; ++n) insertln(); break; case 'd': for (n = 0; n < st.count; ++n) deleteln(); break; case 'I': insdelln(st.count); break; case 'D': insdelln(-st.count); break; case 'f': fill_window(stdscr); reshow_status(stdscr, &st); break; case 'w': do_subwindow(stdscr, &st, test_winsdelln); break; case 'q': return; default: update_status(stdscr, &st); break; } } while ((st.ch = getch()) != ERR); }
static TACommandVerdict insdelln_cmd(TAThread thread,TAInputStream stream) { int n; int res; n = readInt(&stream); START_TARGET_OPERATION(thread); res = insdelln(n); END_TARGET_OPERATION(thread); writeInt(thread, res); sendResponse(thread); return taDefaultVerdict; }