tumashu / ivy-posframe

ivy-posframe is a ivy extension, which let ivy use posframe to show its candidate menu, ivy-posframe is a **GNU ELPA** package.
415 stars 26 forks source link

Add dynamic resizing #50

Closed CeleritasCelery closed 5 years ago

CeleritasCelery commented 5 years ago

I have been thinking about a solution that closes #31. I think the best solution is to give the option to the user as to how they want to handle this. This PR adds options ivy-posframe-dynamic-width and ivy-posframe-dynamic-height which allow the frame to be resized in those directions. I also allow the user to define their own function for setting the height and width. Currently if the user wants to set the width to 50% of the frame instead of the default 62%, they have no way to do that.

I removed the customization for the min dimension because it only comes into play when setting the the size dynamically. In that case we can just use ivy-posframe-height and ivy-posframe-width.

I feel like this makes more sense and gives more power to the user for how they want to the posframe to behave. Let me know what you think.

tumashu commented 5 years ago

In my opinion, we just add a function ivy-posframe-return-size, to return width and height really used, if user want to hack, he just override ivy-posframe-return-size

tumashu commented 5 years ago

I have add a simpler approach, just try it

(defcustom ivy-posframe-size-function #'ivy-posframe-get-size
  "The function which is used to deal with posframe's size."
  :group 'ivy-posframe
  :type 'function)
CeleritasCelery commented 5 years ago

Touché. That is a much simpler solution and I like it.