GNU bug report logs - #44315
display property :align-to doesn't update with text-scale-mode

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Thu, 29 Oct 2020 20:37:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 44315 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#44315; Package emacs. (Thu, 29 Oct 2020 20:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefan <at> marxist.se>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 29 Oct 2020 20:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: bug-gnu-emacs <at> gnu.org
Subject: display property :align-to doesn't update with text-scale-mode
Date: Thu, 29 Oct 2020 13:36:30 -0700
The display property :align-to space doesn't update when I change the
text-scale using `text-scale-increase', `text-scale-decrease' or
`text-scale-adjust', as can be seen here:

0. emacs -Q
1. Evaluate:
(progn (insert (make-string 60 ?*) "\n")
       (insert (propertize " " 'display '(space :align-to 60)))
       (insert "*\n")
       (text-scale-increase 1))

The result is that the first line extends beyond the position of the
"*" character on the second line.

I expect them to line up.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44315; Package emacs. (Fri, 30 Oct 2020 07:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 44315 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 44315 <at> debbugs.gnu.org
Subject: Re: bug#44315: display property :align-to doesn't update with
 text-scale-mode
Date: Fri, 30 Oct 2020 09:31:14 +0200
tags 44315 notabug
severity 44315 wishlist
thanks

> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Thu, 29 Oct 2020 13:36:30 -0700
> 
> 0. emacs -Q
> 1. Evaluate:
> (progn (insert (make-string 60 ?*) "\n")
>        (insert (propertize " " 'display '(space :align-to 60)))
>        (insert "*\n")
>        (text-scale-increase 1))
> 
> The result is that the first line extends beyond the position of the
> "*" character on the second line.

As it should be.  :align-to interprets the number 60 in terms of the
frame's default font width, see the ELisp manual.  And that doesn't
change with text-scale-increase, whose effect is buffer-local.

> I expect them to line up.

You expected a feature that doesn't exists.  To update the alignment
in these cases, we could:

  1) modify the application which uses :align-to to update the
     property values when the scale changes (e.g., by tracking these
     changes in a pre-redisplay-functions hook); or
  2) invent a new form of value for :align-to that would scale with
     the buffer's text scale, for example '(scale . 123)'

Patches welcome.




Added tag(s) notabug. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 30 Oct 2020 07:32:02 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 30 Oct 2020 07:32:02 GMT) Full text and rfc822 format available.

Removed tag(s) notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Fri, 09 Apr 2021 17:00:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44315; Package emacs. (Sun, 02 Jan 2022 21:03:02 GMT) Full text and rfc822 format available.

Message #17 received at 44315 <at> debbugs.gnu.org (full text, mbox):

From: Thomas Hisch <thomas.hisch <at> ims.co.at>
To: <44315 <at> debbugs.gnu.org>
Date: Sun, 2 Jan 2022 22:02:31 +0100
> From: Eli Zaretskii <eliz <at> gnu.org>
> You expected a feature that doesn't exists.  To update the alignment
> in these cases, we could:

>  1) modify the application which uses :align-to to update the
>     property values when the scale changes (e.g., by tracking these
>     changes in a pre-redisplay-functions hook); or

I think this should be easy to do (at least for tabulated-list-mode).
What we need for this is a scale value, which we could use for scaling
the :align-to value. I tried using the `text-scale-mode-step' (defaults
to 1.2) value but the text is still not aligned when using Stefan's example

(let ((scale-value 1)
      (scale-step 1.2))
  (text-scale-set scale-value)
  (insert "\n" (make-string 60 ?*) "\n")
  (insert (propertize " " 'display `(space :align-to ,(* 60 (expt
scale-step scale-value)))))
  (insert "*\n")
  )

I run the above code with various scale-values (1, 2, 3, 4) and an
empirically determined best scaling factor (scale-step), but this value
doesn't lead to good results for all scale-values.

Do you have a better idea what we could do to map the text-scale to an
:align-to value for the scaled default font?

>  2) invent a new form of value for :align-to that would scale with
>     the buffer's text scale, for example '(scale . 123)'

I don't have enough knowledge to comment on whether this would be better
than your first suggestion.

Best regards
Thomas


Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly prohibited.

IMS Nanofabrication GmbH FN: 208021 p, FB-Gericht: Wiener Neustadt; Sitz: Wolfholzgasse 20-24, 2345, Brunn am Gebirge (Austria),Tel. +43 1 214 48 94; E-Mail: imsoffice <at> ims.co.at; DVR-Nr: 0374369; www.ims.co.at




This bug report was last modified 3 years and 261 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.