]> git.neil.brown.name Git - edlib.git/commitdiff
lib-abbrev: fix positioning of menu
authorNeilBrown <neil@brown.name>
Mon, 17 Jul 2023 11:27:30 +0000 (21:27 +1000)
committerNeilBrown <neil@brown.name>
Tue, 18 Jul 2023 11:51:36 +0000 (21:51 +1000)
The xy location of the menu must be relative to the parent of the menu.

Signed-off-by: NeilBrown <neil@brown.name>
core-pane.c
python/lib-abbrev.py

index 08c5e43b356796f9e27772aed3156288837a82aa..e30420937586cf68441f2343c2815c75aad0d146 100644 (file)
@@ -1065,11 +1065,12 @@ struct call_return do_call_bytes(enum target_type type, struct pane *home,
 struct xy pane_mapxy(struct pane *p safe, struct pane *target safe,
                     short x, short y, bool clip)
 {
+       /* x and y are relative to p.  The result xy is relative to target */
        struct xy xy;
 
        /* This is a bit of a hack, but is needed to map lib-renderline
         * co-ordes to a pane which is parallel with the render-line
-        * pane, but might be further fromt the root.
+        * pane, but might be further from the root.
         * We move 'target' towards the root to a pane of exactly the
         * same size and position.  This will not change a correct
         * result, and can make a correct result more likely.
index f5a3ceedfc7a9f7c5df15d6a36903dc076627977..2aaa8c82cfc0b93beb5659d1178a0bb8c79f6ae2 100644 (file)
@@ -201,7 +201,7 @@ class AbbrevPane(edlib.Pane):
 
         p = self.menu.call("ThisPopup", ret='pane')
         if p:
-            xy = p.mapxy(focus, xy[0], focus.h)
+            xy = p.parent.mapxy(focus, xy[0], focus.h)
             p.x = xy[0]
             p.y = xy[1]
         return edlib.Efallthrough