Hi, > while wmove(stdscr, ...) seems to work fine, wmove(<other_window>, ...) > doesn't move the physical cursor, even if the other window has the same > position and size as stdscr. Tested with NetBSD 7.99.39 > (GENERIC.201609300910Z) amd64. Is this a known problem? (The problem does > not occur with ncurses from pkgsrc.)
I can't reproduce this locally - wmove() and move() fail to move the cursor for me if I don't call refresh(). Note, that the cursor will move if there is any output. I am using the attached test program, where I can see the cursor position both with and without text output. In more detail, we don't set the __ISDIRTY flag in wmove(). However, if we call wgetch(), there is an optimisation that checks if any line is dirty before calling wrefresh(). This means that wmove() will not move always move the cursor. Can you try the attached patch and see if that makes things work for you? Regards, J -- My other computer runs NetBSD too - http://www.netbsd.org/
#include <stdio.h> #include <curses.h> main () { WINDOW *win1; if (initscr() == NULL) { fprintf(stderr, "Failed to initialise terminal (%s)\n", getenv("TERM")); exit(1); } win1 = newwin(LINES, COLS, 0, 0); if (win1 == NULL) { mvaddstr(1, 1, "Unable to create windows\n"); getch(); exit(1); } noecho(); cbreak(); leaveok(stdscr, 1); move(8, 8); getch(); leaveok(stdscr, 0); move(4, 4); getch(); wmove(win1, 0, 0); wgetch(win1); waddch(win1, '0'); wgetch(win1); wmove(win1, 2, 2); wgetch(win1); waddch(win1, '2'); wgetch(win1); move(8, 8); refresh(); getch(); endwin(); exit (0); }
--- /usr/src/lib/libcurses/getch.c 2012-05-14 19:16:03.000000000 +0100 +++ ./getch.c 2016-11-21 20:49:38.000000000 +0000 @@ -811,8 +811,7 @@ && __echoit) return (ERR); - if (is_wintouched(win)) - wrefresh(win); + wrefresh(win); #ifdef DEBUG __CTRACE(__CTRACE_INPUT, "wgetch: __echoit = %d, " "__rawmode = %d, __nl = %d, flags = %#.4x, delay = %d\n",