Prefix Key Press Causes Pop-Up Window to Shift to the Right
Summary
When a pop-up window is open and I press the general.el prefix key, the current pop-up shifts to the right instead of opening a new window below. It seems like Popper might be trying to manage a window it shouldn't.
Steps to Reproduce
- Install
popper.el. - Install
general.eland create a definer:
(use-package general
:config
(general-create-definer my-keys
:states '(normal visual motion)
:keymaps 'override
:prefix "SPC")
(my-keys ":" '("M-x" . execute-extended-command)))
- Open a Help window using
describe-function. - Press your
general.elprefix key (e.g., the space bar).
Expected Behavior
The general.el window should appear beneath the Help window.
Actual Behavior
The Help window is pushed to the right within the managed pop-up window.
which-key and popper both use side windows at the bottom of the frame, so this is expected. You have to ask one of them to not use the bottom of the frame. Customize which-key-side-window-location or popper-display-function.
I have the same problem, when which-key is launched, it pushes the popper window fr right and this one is unusable, and the right part of the which-key popup is hidden, and you cannot see it.
Of course we can choose two different locations for popper and which-key, but the bottom of the frame is often handy for both.
I think a better answer would be to hide the popper buffer, the time to complete your key entry (usually very short) and to un-hide it after.
I suppose we might use which-key-inhibit-display-hook to hide popper, but I don't see a hook in which-key to allow to restore the popper window when which-key is closed. May be we could advise which-key--hide-popup
But I am certain that @karthink you can give easily some advice
One other thing you could try is to set which-key-side-window-slot to 1 (the default is 0). Popper also uses slot 1 by default, so which-key will be forced to use the same side-window as Popper. I don't know if it will restore the popup buffer when which-key exits, though.
Thanks a lot @karthink, it works perfectly, the which-key buffer replace popper, which comes back after exiting which-key. If we set this value to 0 (middle) or negative (left), the overlapping occur, but when positive (right) it works well. The rule seems to be to use the same slot for both. I think that you could close this bug, but may-be mentioning it in the README can be useful, which-key is widely used and included in emacs 30, and the defaults is side window, with slot 0. So this problem may affect many users, they may not have reported it previously, because it is not blocking.
I think the better fix would be to simply change Popper's default side-window slot to 0. However, I don't know if some users might prefer both windows (Popper and which-key) to be shown. A wide enough screen can accommodate both comfortably.
A wide screen, cannot accommodate both, because which-key by default arrange the menu line by line, and only when one is filled up, it begins a new one, so even with 12 items you can fill the whole width of even a wide screen. It should rearrange the items when an other slot is used, to share the screen in a fair way; but it does not.
If we want to act only on the popper side, better than assign slot 0 to popper, would be to have a custom variable for the slot, with as default the which-key slot if it is defined, or 0. This will let the user choose the preferred placement.
@marczz Right, thanks for addressing that suggestion. I've changed Popper's default window slot to 0, so it should share the window with which-key now.