tumashu / vertico-posframe

GNU General Public License v3.0
106 stars 16 forks source link

Question: how to redraw the posframe after toggling vertico-posframe-truncate-lines #33

Open fuyu0425 opened 1 year ago

fuyu0425 commented 1 year ago

Hi I have a question: I want to redraw the vertico-posframe after toggle vertico-posframe-truncate-lines

This is my code.

(defun leo/toggle-vertico-posframe-truncate-lines ()
      (interactive)
      (setq vertico-posframe-truncate-lines
            (not vertico-posframe-truncate-lines))
      (vertico-posframe-cleanup))

    (define-key vertico-multiform-map (kbd "M-L") #'leo/toggle-vertico-posframe-truncate-lines))

I have also tested (redraw-frame posframe--frame) but it does not work either.

Use case. test with find-file with long directory path (longer than vertico-posframe-width)

Without posframe

圖片

posframe with truncate line

圖片

posframe without truncate line

(setq vertico-posframe-width 100
          vertico-posframe-height 21)
圖片

And I want to Hit M-L to toggle between two.

But when I toggle from with truncate line to without truncate line

It does not work, only when I move the cursor back a little, the truncate line get back to having an effect.

Like the following GIF. vertico-posframe

Initially with truncate-line off => M-L => truncate-line on => M-L => truncate-line off again but I need to move cursor back to have the same effect the the initial one.

Not sure whether I should ask this question in vertico-posframe or vertico