GNU bug report logs -
#30746
window-text-pixel-width includes width of following propertized space
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30746 in the body.
You can then email your comments to 30746 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#30746
; Package
emacs
.
(Wed, 07 Mar 2018 22:14:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Clément Pit-Claudel <clement.pitclaudel <at> live.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 07 Mar 2018 22:14:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi all,
I'm trying to measure strings in an Emacs buffer. The current code is yielding surprising results:
(progn
(save-excursion
(insert #("s " 1 2 (display (space :width (50))))))
(window-text-pixel-size nil (point) (1+ (point))))
On my machine a single 's' is 8 pixels wide, but this snippet returns 58.
The following snippet, however, returns 8 as expected:
(progn
(save-excursion
(insert "s "))
(window-text-pixel-size nil (point) (1+ (point))))
It seems that adding a display property on the space changes the return value of window-text-pixel-size; is that expected?
Thanks,
Clément.
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#30746
; Package
emacs
.
(Thu, 08 Mar 2018 13:35:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 30746 <at> debbugs.gnu.org (full text, mbox):
> From: Clément Pit-Claudel <clement.pitclaudel <at> live.com>
> Date: Wed, 7 Mar 2018 17:13:32 -0500
>
> (progn
> (save-excursion
> (insert #("s " 1 2 (display (space :width (50))))))
> (window-text-pixel-size nil (point) (1+ (point))))
>
> On my machine a single 's' is 8 pixels wide, but this snippet returns 58.
>
> The following snippet, however, returns 8 as expected:
>
> (progn
> (save-excursion
> (insert "s "))
> (window-text-pixel-size nil (point) (1+ (point))))
>
> It seems that adding a display property on the space changes the return value of window-text-pixel-size; is that expected?
It's expected given the relatively naïve implementation, which didn't
expect such calamities. Hopefully now fixed on the master branch.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#30746
; Package
emacs
.
(Fri, 16 Mar 2018 14:10:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 30746 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2018-03-08 08:33, Eli Zaretskii wrote:
>> From: Clément Pit-Claudel <clement.pitclaudel <at> live.com>
>> Date: Wed, 7 Mar 2018 17:13:32 -0500
>>
>> (progn
>> (save-excursion
>> (insert #("s " 1 2 (display (space :width (50))))))
>> (window-text-pixel-size nil (point) (1+ (point))))
>>
>> On my machine a single 's' is 8 pixels wide, but this snippet returns 58.
>>
>> The following snippet, however, returns 8 as expected:
>>
>> (progn
>> (save-excursion
>> (insert "s "))
>> (window-text-pixel-size nil (point) (1+ (point))))
>>
>> It seems that adding a display property on the space changes the return value of window-text-pixel-size; is that expected?
>
> It's expected given the relatively naïve implementation, which didn't
> expect such calamities. Hopefully now fixed on the master branch.
Thanks a lot; the width is indeed fixed. However, the fix seems to have broken the height calculation: the first snippet above now returns (8 . 0), whereas the second one returns (8 . 16).
Cheers,
Clément.
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#30746
; Package
emacs
.
(Fri, 16 Mar 2018 16:14:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 30746 <at> debbugs.gnu.org (full text, mbox):
> Cc: 30746 <at> debbugs.gnu.org
> From: Clément Pit-Claudel <clement.pitclaudel <at> live.com>
> Date: Fri, 16 Mar 2018 10:09:40 -0400
>
> Thanks a lot; the width is indeed fixed. However, the fix seems to have broken the height calculation: the first snippet above now returns (8 . 0), whereas the second one returns (8 . 16).
Fixed.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#30746
; Package
emacs
.
(Fri, 16 Mar 2018 20:50:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 30746 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2018-03-16 12:13, Eli Zaretskii wrote:
>> Cc: 30746 <at> debbugs.gnu.org
>> From: Clément Pit-Claudel <clement.pitclaudel <at> live.com>
>> Date: Fri, 16 Mar 2018 10:09:40 -0400
>>
>> Thanks a lot; the width is indeed fixed. However, the fix seems to have broken the height calculation: the first snippet above now returns (8 . 0), whereas the second one returns (8 . 16).
>
> Fixed.
Works perfectly. Thanks a lot.
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#30746
; Package
emacs
.
(Sat, 28 Sep 2019 21:52:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 30746 <at> debbugs.gnu.org (full text, mbox):
fixed 30746 26.1
close 30746
quit
Clément Pit-Claudel <clement.pitclaudel <at> live.com> writes:
> On 2018-03-16 12:13, Eli Zaretskii wrote:
>>> Cc: 30746 <at> debbugs.gnu.org
>>> From: Clément Pit-Claudel <clement.pitclaudel <at> live.com>
>>> Date: Fri, 16 Mar 2018 10:09:40 -0400
>>>
>>> Thanks a lot; the width is indeed fixed. However, the fix seems to have broken the height calculation: the first snippet above now returns (8 . 0), whereas the second one returns (8 . 16).
>>
>> Fixed.
>
> Works perfectly. Thanks a lot.
This was fixed by:
commit c4db7662bb4740f069e494cfe632c76a0d21d6d7
Author: Eli Zaretskii <eliz <at> gnu.org>
Date: Fri Mar 16 18:11:07 2018 +0200
Another followup to fixing 'window-text-pixel-width'
* src/xdisp.c (Fwindow_text_pixel_size): Adjust the return value
when we stop one buffer position short of TO. (Bug#30746)
And:
commit f1f12d8be3ddc5aa0a79658f5b339c78742321fa
Author: Eli Zaretskii <eliz <at> gnu.org>
Date: Thu Mar 8 15:32:23 2018 +0200
Fix 'window-text-pixel-size' when display properties are around
* src/xdisp.c (Fwindow_text_pixel_size): Correct the result when
there's a display property at the TO position, and the call to
move_it_to overshoots. (Bug#30746)
I'm therefore closing this bug report.
Best regards,
Stefan Kangas
bug Marked as fixed in versions 26.1.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sat, 28 Sep 2019 21:52:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
30746 <at> debbugs.gnu.org and Clément Pit-Claudel <clement.pitclaudel <at> live.com>
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sat, 28 Sep 2019 21:52:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 27 Oct 2019 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 175 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.