unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Brahimi Saifullah <brahimi.saifullah@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, martin rudalics <rudalics@gmx.at>
Cc: 51995@debbugs.gnu.org
Subject: bug#51995: 29.0.50; `string-pixel-width' depends on the current window width
Date: Sun, 21 Nov 2021 15:38:05 -0300	[thread overview]
Message-ID: <84ee79xsky.fsf@gmail.com> (raw)
In-Reply-To: <84czmvbepd.fsf@gmail.com>

>He mean a REALLY long line.  Like thousands of characters.

>These examples are harmless.  Please try to test (1) with a large buffer
>that has no newline characters and (2) with 'truncate-lines' non-nil.
>'window-text-pixel-size' must be able to handle these cases gracefully
>even if it's not geared to them.

I think there's a misunderstading.
I meant that a facility should be added to `window-text-pixel-size' so
that callers like `string-pixel-width' can ask for having no (X) limit
without specifying a large number themselves.  Basically I want to use:

  (window-text-pixel-size window (point-min) (point) t)
                                                    ^^^
   (or some other value that `window-text-pixel-size' 
   should understand as meaning "no limit" for X-LIMIT)

instead of:

  (window-text-pixel-size window (point-min) (point) 123456789)

The default behavior of the function should stay the same.

>Any clients of 'window-text-pixel-size' like 'string-pixel-width' can
>easily set X-LIMIT to some sufficiently large value without affecting
>the basic functionality of 'window-text-pixel-size'.

Yes, that's the simplest solution, but I find passing a random magic number
instead of providing a simple interface to say "I don't want to use a limit"
(like Y-LIMIT already allows, as I previously mentioned) rather inelegant :)

>Please try the attached patch (if it doesn't apply, I'll send you the
>affected functions separately so you can apply the changes manually).

Can you explain how you are supposed to apply it?

I tried:

  git apply buffer-text-pixel-size.diff

But all it says is:

  error: corrupt patch at line 12

I did apply the changes manually by looking at the .diff file,
and it's seemingly working for me.  Minus one glaring issue:
`string-pixel-width' is using `buffer-size' as the X-LIMIT, but
that function returns the amount of characters in the buffer.
This means that instead of returning the pixel width, it merely
returns the amount of characters in a string.  If I change that,
everything else seems to be in good order.





  parent reply	other threads:[~2021-11-21 18:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-20  5:04 bug#51995: 29.0.50; `string-pixel-width' depends on the current window width Brahimi Saifullah
2021-11-20  7:20 ` Eli Zaretskii
2021-11-20  8:48 ` martin rudalics
2021-11-20  9:35   ` Lars Ingebrigtsen
2021-11-20 21:36 ` Brahimi Saifullah
2021-11-20 21:42 ` Brahimi Saifullah
2021-11-21  6:34   ` Eli Zaretskii
2021-11-21  9:12   ` martin rudalics
2021-11-21 18:38 ` Brahimi Saifullah [this message]
2021-11-22  9:28   ` martin rudalics
2021-11-22 11:04     ` Lars Ingebrigtsen
2021-11-22  0:53 ` Brahimi Saifullah

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=84ee79xsky.fsf@gmail.com \
    --to=brahimi.saifullah@gmail.com \
    --cc=51995@debbugs.gnu.org \
    --cc=eliz@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).