]> git.neil.brown.name Git - edlib.git/commitdiff
Change how Move-CursorXY is passed "no change" co-ordinates.
authorNeilBrown <neil@brown.name>
Tue, 18 Jul 2023 10:57:36 +0000 (20:57 +1000)
committerNeilBrown <neil@brown.name>
Tue, 18 Jul 2023 11:51:36 +0000 (21:51 +1000)
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 <neil@brown.name>
mode-emacs.c
render-lines.c

index ea47364a92974bdd9bd8994a11053728cfb8fa7a..e9d0f870d62c1bdef13ba765fb727b54da452fd6 100644 (file)
@@ -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)
index 2d47b38dce744046a0af36422732491986060796..ab1c6fa47e8ae8fc6050a9e6fd3d9a8a16fc727d 100644 (file)
@@ -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);