emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about minibuffer and child frames (Posframe)


From: Gerd Möllmann
Subject: Re: Question about minibuffer and child frames (Posframe)
Date: Mon, 07 Oct 2024 06:28:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Feng Shu <tumashu@163.com> writes:

> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>
> Wow, this is a good feature.

Thanks :-).

And BTW, thanks for Posframe! As you can see I value it enough to go to
great lengths to get it :-).

>
> posframe do not handle focus in most situation, for it is too complicate
> to let focus work. posframe just *show* the content of a buffer.
>
> When enable vertico-posframe, we just let the content of minibuffer is
> showed in a posframe, but input handle is in parent frame, we lock the
> height of parent minibuffer window and vscroll minibuffer window to hide
> minibuffer content in below function.
>
>
> (defun vertico-posframe--handle-minibuffer-window ()
>   "Handle minibuffer window."
>   (let ((show-minibuffer-p (vertico-posframe--show-minibuffer-p))
>         (minibuffer-window (active-minibuffer-window)))
>     (setq-local max-mini-window-height 1)
>     (window-resize minibuffer-window
>                    (- (window-pixel-height minibuffer-window))
>                    nil nil 'pixelwise)
>     (set-window-vscroll minibuffer-window 100)
>     (when show-minibuffer-p
>       (set-window-vscroll minibuffer-window 0))))

Very interesting, I hadn't noticed that at all! That explains why the
minibuffer appears empty on GUI frames because set-window-vscroll has no
effect on ttys. When I added the vscroll, I thought it wouldn't be
needed on terminals because there are no partially visible lines or
images or anything like that. And adding it would be quite difficult I
think, so it's not an option.

>> On GUI, consult-buffer pops up a child frame, which has, AFAICT, a
>> minibuffer at the top. The cursor is in that minibuffer. The minibuffer
>
> the minibuffer showed in posframe is not real minibuffer :-)

Yeah, that was quite confusing for w while :-).

>> ih the parent frame looks inactive. There is no prompt or anything else.
>> That's how it should be.
>
> No, it's content is hide, but it active.

Got it. By setting vscroll.

>> With my new code on tty, the same child frame pops up, but this time the
>> child frame's minibuffer contains a prompt and what I type is displayed
>> there and so on, but it doesn't have a visible cursor. The parent
>
>
> in posframe, cursor just a space with face of cursor.

So Po Lu was remembering right!

Do you perhaps know where that is done? I can't find it.

Because it's definitely not working on ttys ATM. I mean the cursor in
the parent frame's minibuffer doesn't bother me too much. But I would
love it if something like a cursor appeared on the posframe.

>> frame's minibuffer this time contains the prompt and the cursor, too.
>
> Maybe the below hack is not work well in tty
>
>    (set-window-vscroll minibuffer-window 100)

Yes, that's it. It's a no-op on terminals. 

> In my opinion, hide minibuffer's content just hack way, I can not find a
> better way to hide minibuffer window's content.

Well, nobody could forsee that there would ever be child frames on tty
;-). 

P.S.:

As an aside, because that might affect Posframe maybe in the future. I
also implemented borders around child frames now, but in a strange way,
with the 'undecorated' frame parameter. If a tty child frame is not
undecorated, a border is drawn around it, otherwise it isn't.

The reason for this strange way of doing things is that I quit in a rage
when trying to add the normal border handling for tty frames. Works for
me. Just mentioning it so that others can comment how terrible that is :-).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]