Advertisement
Nofew

CursesWmove()Bug

May 23rd, 2016
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.91 KB | None | 0 0
  1. // The code below doesn't move the cursor.
  2.  
  3. #include <curses.h>
  4.  
  5. int main(void) {
  6.     initscr();
  7.     resize_term(50, 100);
  8.     raw();
  9.     nonl();
  10.     noecho();
  11.     keypad(stdscr, TRUE);
  12.     curs_set(2);
  13.  
  14.     WINDOW *Wind;
  15.  
  16.     Wind = newwin(30, 30, 5, 5);
  17.     box(Wind, 0, 0);
  18.     wmove(Wind, 1, 1);
  19.     wrefresh(Wind);
  20.     refresh();
  21.  
  22.     getch();
  23.  
  24.     return 0;
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31. // The code below does move the cursor, so we definitely have control over the cursor, but I'd really rather not do "move(1+getbegy(Wind), 1+getbegy(Wind));" every time I do something like this.
  32.  
  33. #include <curses.h>
  34.  
  35. int main(void) {
  36.     initscr();
  37.     resize_term(50, 100);
  38.     raw();
  39.     nonl();
  40.     noecho();
  41.     keypad(stdscr, TRUE);
  42.     curs_set(2);
  43.  
  44.     WINDOW *Wind;
  45.  
  46.     Wind = newwin(30, 30, 5, 5);
  47.     box(Wind, 0, 0);
  48.     move(1, 1);
  49.     wrefresh(Wind);
  50.     refresh();
  51.  
  52.     getch();
  53.  
  54.     return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement