From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Correct way to implement `pixel-point-and-height-at-unseen-line'? Date: Mon, 13 Dec 2021 16:32:48 +0200 Message-ID: <838rwomv73.fsf@gnu.org> References: <87pmq1wag9.fsf.ref@yahoo.com> <87pmq1wag9.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38686"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 13 15:33:22 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1mwmOH-0009ox-DT for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 13 Dec 2021 15:33:21 +0100 Original-Received: from localhost ([::1]:43644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwmOF-0001yt-EZ for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 13 Dec 2021 09:33:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwmNq-0001yO-TJ for help-gnu-emacs@gnu.org; Mon, 13 Dec 2021 09:32:54 -0500 Original-Received: from [2001:470:142:3::e] (port=33158 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwmNq-0006Hu-2f for help-gnu-emacs@gnu.org; Mon, 13 Dec 2021 09:32:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SwaI+IjYILuVK9u068hpJsYuh/wyqEeD7145sXDb/I0=; b=PrQruJDBxNj4 EAXYgzUsrxJAqrmgYjf9YsG2ksh1ZzE10Y1q0HBjunnm7WP19OecAG5q9O5NSGkz02+fTiVvl6BMK dYxnAnBg9ixf1VkrhGvszmXHyBUU6zvaGPDu95YopMSzJUWRDykGrPQm3rRnbtU6YjdALJpqXj8Jp 0bcNBA/qvUq0SjJ2hZYwyMQIT1q0n5qt4PuC03CXKXeXJP4FhmA/ynoQcmo1RP/91jZEonFUn/hZ/ cWAiJ9ZITPMxDN4GO4V0lvF9DrG/NcJ6WU+nCj1eKINGqkpUkegXzb6Swj3Koy89MBRDG2dPQDoaJ OwMP+Z2DA+QhQXiUQikyYA==; Original-Received: from [87.69.77.57] (port=4484 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwmNp-0000un-7A for help-gnu-emacs@gnu.org; Mon, 13 Dec 2021 09:32:53 -0500 In-Reply-To: <87pmq1wag9.fsf@yahoo.com> (message from Po Lu on Mon, 13 Dec 2021 09:38:30 +0800) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:134960 Archived-At: > From: Po Lu > Date: Mon, 13 Dec 2021 09:38:30 +0800 > > I don't know how to make `pixel-point-and-height-at-unseen-line' work > correctly: if I use `line-pixel-height', it will only report the height > the first individual line inside a display string if there is one above > window start, but if I use `window-text-pixel-size', I have to determine > the region to measure, which is quite troublesome. > > For example, window start is often not the beginning of a visual line in > Info buffers, so in order to measure the height of the previous line (or > object), I have to find the beginning of the visual line at window > start, and pass that as the `to' argument to window-text-pixel-size > instead. > > This works okay until there is a `line-prefix' property at window start: > in this case, window start is the beginning of a visual line, but it > does not display at the beginning of the line, which means > `window-text-pixel-size' will add the height of the current line to that > of the previous line. I will add a workaround to pixel-scroll.el, but > there must be a cleaner way to implement this. The correct way is to use window-text-pixel-size. Whatever problems that gives you in some corner use cases, we'd need to teach window-text-pixel-size to handle those at least optionally. And you didn't describe why do you need pixel-point-and-height-at-unseen-line's data in the first place, so maybe there's a different solution to whatever you are trying to do that doesn't involve such a function.