popper icon indicating copy to clipboard operation
popper copied to clipboard

Prefix Key Press Causes Pop-Up Window to Shift to the Right

Open creese opened this issue 1 year ago • 1 comments

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.

Screenshot 2024-09-02 at 4 13 33 PM

Steps to Reproduce

  1. Install popper.el.
  2. Install general.el and 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)))
  1. Open a Help window using describe-function.
  2. Press your general.el prefix 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.

creese avatar Sep 02 '24 23:09 creese

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.

karthink avatar Sep 03 '24 03:09 karthink

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

marczz avatar Nov 29 '24 15:11 marczz

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.

karthink avatar Nov 29 '24 16:11 karthink

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.

marczz avatar Nov 29 '24 17:11 marczz

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.

karthink avatar Nov 29 '24 17:11 karthink

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 avatar Nov 29 '24 18:11 marczz

@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.

karthink avatar Dec 01 '24 01:12 karthink