unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Sébastien Chapuis" <sebastien@chapu.is>
To: martin rudalics <rudalics@gmx.at>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: [PATCH] Add function window-line-width
Date: Mon, 11 Nov 2019 03:02:23 +0800	[thread overview]
Message-ID: <CAN2Hsvze07OFatH-tjxd8YM0abuRNkh1FBhSyu3BBLf6BRv31g@mail.gmail.com> (raw)
In-Reply-To: <2fd8c643-af51-9d98-522e-81180a3736f2@gmx.at>

[-- Attachment #1: Type: text/plain, Size: 1825 bytes --]

> There's always the problem that we want to reserve space for a block
> cursor at line end.

IMO that's a case that should be handled by the user of the function, not
by 'window-lines-pixel-dimensions' itself.
In my few tests, 'window-lines-pixel-dimensions' returns a width with 1 and
2 glyphs more, so it's not just 1 space for the block cursor,
there might be cases where there are more glyphs added (?).
And AFAIK, there is no way to know how many glyphs/pixels the redisplay add.
Anyone who wants to have an accurate number of pixels displayed will be
unable to use this function.

> Then we probably should rewrite 'window-text-pixel-size' as Eli
> suggested earlier.

Agreed, but I would prefer to use 'window-lines-pixel-dimensions' since
this is exactly the function I need.
As per the documentation [1]:
`window-text-pixel-size treats the text displayed in a window as a whole
and does not care about
 the size of individual lines. The following function
[window-lines-pixel-dimensions] does.`

[1]
https://www.gnu.org/software/emacs/manual/html_node/elisp/Size-of-Displayed-Text.html#Size-of-Displayed-Text

Thanks,
Sebastien Chapuis.


Le dim. 10 nov. 2019 à 17:46, martin rudalics <rudalics@gmx.at> a écrit :

>  > A line with X characters should have the width of all thoses characters.
>  > I see that 'window-largest-empty-rectangle' uses this function, the
> widths
>  > of the rectangles it returns are smaller than they really are.
>
> There's always the problem that we want to reserve space for a block
> cursor at line end.
>
>  > I tested the following code:
> [...]
>  > `(time (test1))` returns 0.000004869
>  > `(time (test2))` returns 0.00376
>
> Then we probably should rewrite 'window-text-pixel-size' as Eli
> suggested earlier.
>
> martin
>

[-- Attachment #2: Type: text/html, Size: 2493 bytes --]

  reply	other threads:[~2019-11-10 19:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 22:49 [PATCH] Add function window-line-width Sébastien Chapuis
2019-11-07  8:40 ` martin rudalics
2019-11-07  8:50   ` martin rudalics
2019-11-08  4:54     ` Sébastien Chapuis
2019-11-08  9:21       ` martin rudalics
2019-11-08 13:18         ` Eli Zaretskii
2019-11-08 18:27           ` martin rudalics
2019-11-09 22:09             ` Sébastien Chapuis
2019-11-10  9:46               ` martin rudalics
2019-11-10 19:02                 ` Sébastien Chapuis [this message]
2019-11-14 10:08                   ` Eli Zaretskii
2019-11-14  9:11               ` Eli Zaretskii
2019-11-07  9:23 ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN2Hsvze07OFatH-tjxd8YM0abuRNkh1FBhSyu3BBLf6BRv31g@mail.gmail.com \
    --to=sebastien@chapu.is \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).