From 13607580c7a4887f820b216bff09718d132b3183 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 17 Jul 2023 21:27:30 +1000 Subject: [PATCH] lib-abbrev: fix positioning of menu The xy location of the menu must be relative to the parent of the menu. Signed-off-by: NeilBrown --- core-pane.c | 3 ++- python/lib-abbrev.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core-pane.c b/core-pane.c index 08c5e43b..e3042093 100644 --- a/core-pane.c +++ b/core-pane.c @@ -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. diff --git a/python/lib-abbrev.py b/python/lib-abbrev.py index f5a3ceed..2aaa8c82 100644 --- a/python/lib-abbrev.py +++ b/python/lib-abbrev.py @@ -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 -- 2.39.5