[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about minibuffer and child frames (Posframe)
From: |
Feng Shu |
Subject: |
Re: Question about minibuffer and child frames (Posframe) |
Date: |
Mon, 07 Oct 2024 14:43:53 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>> 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.
Sorry, I remeber wrong, in vertico-posframe, we use real cursor, see
cursor-type in below function.
(defun vertico-posframe--show (buffer window-point)
"`posframe-show' of vertico-posframe.
BUFFER will be showed by `posframe-show'. After `posframe-show'
is called, window-point will be set to WINDOW-POINT."
(let ((posframe
;; Some posframe poshandlers need infos of last-window.
(with-selected-window (vertico-posframe-last-window)
(apply #'posframe-show
buffer
...
(funcall (buffer-local-value 'vertico-posframe-size-function
buffer) buffer)))))
;; NOTE: `posframe-show' will force set window-point to 0, so we
;; need reset it again after `posframe-show'.
(when (numberp window-point)
(let ((window (frame-root-window posframe)))
(when (window-live-p window)
(set-window-point window window-point))))
;; NOTE: posframe will hide cursor, so we need let it show again.
(with-current-buffer buffer
(setq-local cursor-type t)
(setq-local cursor-in-non-selected-windows 'box))))
But in ivy-posframe, we use space emular cursor instead:
(defun ivy-posframe--add-prompt (fn &rest args)
"Add the ivy prompt to the posframe. Advice FN with ARGS."
(apply fn args)
(when (and (display-graphic-p)
(not ivy-posframe--ignore-prompt))
(with-current-buffer (window-buffer (active-minibuffer-window))
(let ((point (point))
(prompt (buffer-string)))
(remove-text-properties 0 (length prompt) '(read-only nil) prompt)
(with-current-buffer ivy-posframe-buffer
(goto-char (point-min))
(delete-region (point) (line-beginning-position 2))
(insert prompt " \n")
(add-text-properties point (1+ point) '(face ivy-posframe-cursor))))))
>
>>> 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
> ;-).
Yes, I have tried many way to hide minibuffer's content, for example:
creating a new posframe to mask minibuffer window, let minibuffer
forecolor = backgroundcolor, but vscroll way is most stable, vertico's
author tell me this way:
>
> 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
> :-).
OK, border setting in posframe is not simple, by the way, how to handle
border width in tty?
------------------------------------------------------------------
By default, posframe shows no borders, but users can specify
borders by setting BORDER-WIDTH to a positive number. Border
color can be specified by BORDER-COLOR.
INTERNAL-BORDER-WIDTH and INTERNAL-BORDER-COLOR are same as
BORDER-WIDTH and BORDER-COLOR, but do not suggest to use for the
reason:
Add distinct controls for child frames' borders (Bug#45620)
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=ff7b1a133bfa7f2614650f8551824ffaef13fadc
--
- Re: Question about minibuffer and child frames (Posframe), (continued)
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/04
- Re: Question about minibuffer and child frames (Posframe), martin rudalics, 2024/10/04
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/04
- Re: Question about minibuffer and child frames (Posframe), martin rudalics, 2024/10/04
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/04
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/05
- Re: Question about minibuffer and child frames (Posframe), Eli Zaretskii, 2024/10/02
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/02
Re: Question about minibuffer and child frames (Posframe), Feng Shu, 2024/10/06
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/07
- Re: Question about minibuffer and child frames (Posframe),
Feng Shu <=
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/07
- Re: Question about minibuffer and child frames (Posframe), Feng Shu, 2024/10/07
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/07
- Re: Question about minibuffer and child frames (Posframe), Feng Shu, 2024/10/07
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/07
- Re: Question about minibuffer and child frames (Posframe), martin rudalics, 2024/10/07
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/07
- Re: Question about minibuffer and child frames (Posframe), Feng Shu, 2024/10/07
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/08
- Re: Question about minibuffer and child frames (Posframe), Gerd Möllmann, 2024/10/08