]> git.neil.brown.name Git - edlib.git/commitdiff
ncurses: fix cursor placement again.
authorNeilBrown <neil@brown.name>
Wed, 9 Sep 2020 02:59:16 +0000 (12:59 +1000)
committerNeilBrown <neil@brown.name>
Wed, 9 Sep 2020 02:59:16 +0000 (12:59 +1000)
If a window has been moved but not redrawn, the current code places the
cursor incorrectly.  We really do need to check if there is a panel that
claims the cursor.  Only if there isn't do we use to more global
cursor setting.

Signed-off-by: NeilBrown <neil@brown.name>
display-ncurses.c

index 0b840fe6d571c1ff365ec1960e039eac72d11458..9b6e6eaad80944c8c2582b87a2b686888f29d1fa 100644 (file)
@@ -853,7 +853,14 @@ DEF_CMD(nc_refresh_post)
                        dest.y, dest.x, destend.y-1, destend.x-1, 0);
        }
        /* place the cursor */
-       if (p->cx >= 0)
+       p1 = pane_leaf(p);
+       pan = NULL;
+       while (p1 != p && (pan = pane_panel(p1, NULL)) == NULL)
+               p1 = p1->parent;
+       if (pan && p1->cx >= 0) {
+               struct xy curs = pane_mapxy(p1, p, p1->cx, p1->cy, False);
+               wmove(stdscr, curs.y, curs.x);
+       } else if (p->cx >= 0)
                wmove(stdscr, p->cy, p->cx);
        refresh();
        record_screen(ci->home);