Selectrum: Completion window mode-line hides last candidates

Created on 24 Mar 2021  路  10Comments  路  Source: raxod502/selectrum

How to Reproduce

$ emacs -Q
(progn
  (package-initialize)
  (require 'selectrum)
  (setq-default
   selectrum-display-action '(display-buffer-at-bottom)
   selectrum-fix-vertical-window-height t
   selectrum-max-window-height 8)
  (selectrum-mode))

Use M-x to trigger a completion window at the bottom.
Use M-> to go to the end of candidates.

What Happens

Last candidate is hidden by the mode-line. I use doom-modeline myself and it can be set with a higher height so in my case the last 2 candidates are hidden rather.

(setq-default doom-modeline-height 40)

What did I Expect

I expected the window height to take into account the eventual mode-line. Probably here: https://github.com/raxod502/selectrum/blob/23162597ac397d62924286a8a04f9405669ab366/selectrum.el#L1510

While digging a little, I noticed 2 things:

  • Selectrum doesn't appear to respect a specified window height. Although that might be by design :thinking:

    (setq-default selectrum-display-action '(display-buffer-in-side-window
                                             (slot . -1)
                                             (window-height . 20)))
    
  • I can't seem to be able to nil the mode-line for the completion window. It would temporarily fix the last hidden candidates issue (and is suitable option for me regardless). Should that be handled with a mode hook to be triggered in the completion buffer?

Most helpful comment

For now you can manually do that in selectrum--display-action-buffer.

No need for a PR. apparently I was just misusing the window parameters alist.

For anyone wondering, the mode-line can be disabled with something like this:

(setq-default selectrum-display-action '(display-buffer-at-bottom
                                         (window-parameters (mode-line-format . none))))

All 10 comments

Selectrum doesn't appear to respect a specified window height. Although that might be by design

This is when you configure selectrum-fix-vertical-window-height which forces the height as determined by selectrum-max-window-height. If you don't set it the hidden candidate issue should be gone, too.

I can't seem to be able to nil the mode-line for the completion window. It would temporarily fix the last hidden candidates issue (and is suitable option for me regardless). Should that be handled with a mode hook to be triggered in the completion buffer?

For now you can manually do that in selectrum--display-action-buffer.

This is when you configure selectrum-fix-vertical-window-height which forces the height as determined by selectrum-max-window-height. If you don't set it the hidden candidate issue should be gone, too.

Mmh I'm not sure I follow. I tried with less customization and still am experiencing hidden candidates:

emacs -Q
(progn
  (package-initialize)
  (require 'selectrum)
  (setq-default selectrum-display-action '(display-buffer-at-bottom))
  (selectrum-mode))

For now you can manually do that in selectrum--display-action-buffer.

Thanks, I'll look into it and provide a PR if I can come up with a decent solution there :-)

Mmh I'm not sure I follow. I tried with less customization and still am experiencing hidden candidates:

Which commands do you execute? Can you try without package-initialize, I don't get hidden candidates that way when using M-x and jumping to the last candidate using M-> in emacs -Q. Which font do you use?

(progn
  (add-to-list 'load-path "~/.config/emacs/elpa/selectrum-20210324.1004")
  (require 'selectrum)
  (setq-default selectrum-display-action '(display-buffer-at-bottom))
  (selectrum-mode))

Then M-x and M->. C-p and C-n to move up and down. With emacs -Q, font is "DejaVu Sans Mono", my configuration uses "Code New Roman".

Tried on another machine (macOS) where I can make a screencast more easily:

https://user-images.githubusercontent.com/5608624/112336737-a3381000-8cbd-11eb-832e-a85ef465c451.mov

Thanks, I don't know why I can't reproduce this but the window resizing can be a weak spot in other situations, too. When I get to rework the window sizing code I will report back here.

For now you can manually do that in selectrum--display-action-buffer.

No need for a PR. apparently I was just misusing the window parameters alist.

For anyone wondering, the mode-line can be disabled with something like this:

(setq-default selectrum-display-action '(display-buffer-at-bottom
                                         (window-parameters (mode-line-format . none))))

FWIW, I can't reproduce anymore.

Good news :) I will close this then...

Thanks, I don't know why I can't reproduce this but the window resizing can be a weak spot in other situations, too. When I get to rework the window sizing code I will report back here.

I could reproduce a similar issue, still using the same setup I shared above. It appears to be related to long lines. Where candidates being displayed over multiple lines make the last candidates hide either behind the mode-line, or the echo area in my case. Since I chose to display the candidates in their own window, I suppose it is more appropriate to fix this issue on my end (by truncating long lines or similar).

Was this page helpful?
0 / 5 - 0 ratings