From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: Question about minibuffer and child frames (Posframe) Date: Mon, 07 Oct 2024 06:28:56 +0200 Message-ID: References: <87jzek200d.fsf@163.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25904"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Emacs Devel , Martin Rudalics To: Feng Shu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 07 06:29:59 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sxfNd-0006ae-TO for ged-emacs-devel@m.gmane-mx.org; Mon, 07 Oct 2024 06:29:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sxfMv-00068O-8U; Mon, 07 Oct 2024 00:29:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sxfMs-000659-SF for emacs-devel@gnu.org; Mon, 07 Oct 2024 00:29:11 -0400 Original-Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sxfMo-00037w-Pm for emacs-devel@gnu.org; Mon, 07 Oct 2024 00:29:10 -0400 Original-Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-42cc8782869so40293065e9.2 for ; Sun, 06 Oct 2024 21:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728275340; x=1728880140; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g2WT4kUttTSXu+RdS1OmMLKx5IcaYsxOHaKncISCtbY=; b=U9U4aQKIs6GRV6pAhjND4m4r+v61O/XQnPdWYZJLym9c3Se1igCit5pvjmc00Zqdqv EhabA462AK+NhldFh4EnAUY+bOntMSLusoJcPix9HtOlAb36h8j2xQ7x2840c3KPRx7O mzPxJbW6iE7Y8ga8PLim+LToq4dbO+JEmcv7v7c2/vd3jI2TY5ooYxD601zipiEu1NgQ mfvcRKHVatCzZDNRuieDj4cmpjK+GXXC8fIRGbnRVgU/OHP3lNgnCVhijDm9wCLTlE1w DcWpNoXOSohG9TZns6F8lDphNPzYeRxzKo0kujLBCZEElJ95Zi0XcSPvO/15yWNFsXTA QU/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728275340; x=1728880140; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=g2WT4kUttTSXu+RdS1OmMLKx5IcaYsxOHaKncISCtbY=; b=mlTwSqwW3v/VTgpqOUEF88kk6vsFBpoE2AXMYAW5E85GlA99uf2ZQyvttmILX528nv 3ja0gVRe0v24Q3e6tKAE8CzTOusEg4Zj54+PokQwVGSVVOc/KUPLpHbrKXp6RDXNgDNE XbHbESYgGzFllEOtU2PbEOcQsrWP1xzi5Se+kVyWBiyqGME2c8B5c4Q5LBtL6ChpqY0L dxrSrsV97NXURRyLwv1fI9YL5EC3a6OcTmng4Al/dtjlbk2V9qVm/6hqlaHaQRJ6JuNO KvrwD0q0aOdMQ7NmcTWJToZRpIkllCINQVoQ1JXTAZP6wZHX5i3inyo7TGmC9H08ba0l c02w== X-Gm-Message-State: AOJu0YxGcT3ZcnOSOgNeLNKaJn1vP0BqTpcfD/8OWGKDA0zCMI71jqoW mjRRNnvWKV4rrRKF9/hhOgIjFhmXQ/c0ZhzXDAjmit08gIz/ZjhZ X-Google-Smtp-Source: AGHT+IHDfN0mbylrGKlIF2FJMEzsRSstykteC/Yd+wIZ/abhntnQBmGEsRkYCw9bE2+JLyAcPQxO+Q== X-Received: by 2002:a05:600c:4f4b:b0:42c:bd27:4be4 with SMTP id 5b1f17b1804b1-42f85aa62e7mr80058485e9.8.1728275339520; Sun, 06 Oct 2024 21:28:59 -0700 (PDT) Original-Received: from pro2 (p4fe3a93e.dip0.t-ipconnect.de. [79.227.169.62]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f86b1d5fesm79753265e9.24.2024.10.06.21.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 21:28:59 -0700 (PDT) In-Reply-To: <87jzek200d.fsf@163.com> (Feng Shu's message of "Mon, 07 Oct 2024 09:08:02 +0800") Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=gerd.moellmann@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:324368 Archived-At: Feng Shu writes: > Gerd M=C3=B6llmann 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.=20 > 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 ;-).=20 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 :-).