radian-software / selectrum

🔔 Better solution for incremental narrowing in Emacs.
MIT License
737 stars 33 forks source link

Select the minibuffer before running commands in a displayed Selectrum buffer. #586

Closed okamsn closed 2 years ago

okamsn commented 2 years ago

Fixes #585. Trying to click on candidates in a buffer displayed via selectrum-display-action would select that window, which would make Selectrum inactive.

This simply reselects the minibuffer window in a local pre-command-hook. I don't think that this would cause any problems, but am not very familiar with this feature. There might be a better way of doing this.

This seems to work with posframe and normal windows, but I'm not sure how well it works with other ways of displaying buffers.

okamsn commented 2 years ago

@lambdadog, please try this change.

okamsn commented 2 years ago

After some more thought, I think that using pre-command-hook is the simplest approach. Ideally, it's only run once per mouse click since typed input must still be given in the minibuffer. There is no reason to try interact with the displayed buffer except to click on a candidate.

lambdadog commented 2 years ago

Sorry I missed this, LGTM though!