From: NeilBrown Date: Tue, 18 Jul 2023 10:57:36 +0000 (+1000) Subject: Change how Move-CursorXY is passed "no change" co-ordinates. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=b2179a58bbee1cb84346bfe4370249e47de4c9a5;p=edlib.git Change how Move-CursorXY is passed "no change" co-ordinates. Currently a negative co-ordinate means "use the ->cx/cy value of the target pane". This allows changing position in one dimension only. However it prevents receiving a negative co-ordinate, which might happen in the mount event happens out-side the pane which has grabbed the mouse. So instead of a negative number, use MAX_INT to say "don't change". Signed-off-by: NeilBrown --- diff --git a/mode-emacs.c b/mode-emacs.c index ea47364a..e9d0f870 100644 --- a/mode-emacs.c +++ b/mode-emacs.c @@ -1972,7 +1972,7 @@ DEF_CMD(emacs_reposition) struct mark *m2 = mark_dup(m); call("Move-CursorXY", ci->focus, 0, m, NULL, 0, NULL, NULL, - -1, repoint < 0 ? ci->focus->h-1 : 0); + INT_MAX, repoint < 0 ? ci->focus->h-1 : 0); if (repoint < 0) /* can only move point backwards */ if (m->seq < m2->seq) diff --git a/render-lines.c b/render-lines.c index 2d47b38d..ab1c6fa4 100644 --- a/render-lines.c +++ b/render-lines.c @@ -1489,8 +1489,8 @@ DEF_CMD(render_lines_set_cursor) int xypos; cih = pane_mapxy(ci->focus, ci->home, - ci->x >= 0 ? ci->x : p->cx >= 0 ? p->cx : 0, - ci->y >= 0 ? ci->y : p->cy >= 0 ? p->cy : 0, + ci->x == INT_MAX ? p->cx : ci->x, + ci->y == INT_MAX ? p->cy : ci->y, False); m = vmark_first(p, rl->typenum, p);