GNU bug report logs - #47712
27.1; Provide `string-display-width` function, which takes properties into account, `substring-width`

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Sun, 11 Apr 2021 21:17:02 UTC

Severity: normal

Found in version 27.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Mendler <mail <at> daniel-mendler.de>
Cc: larsi <at> gnus.org, 47712 <at> debbugs.gnu.org
Subject: Re: bug#47712: 27.1; Provide `string-display-width` function, which
 takes properties into account, `substring-width`
Date: Wed, 14 Apr 2021 11:50:36 +0300
> Cc: 47712 <at> debbugs.gnu.org
> From: Daniel Mendler <mail <at> daniel-mendler.de>
> Date: Tue, 13 Apr 2021 14:25:18 +0200
> 
> Yes, `string-width` is broken for face-dependent purposes. However there 
> are still these handful of use cases which will probably not go away 
> (org-mode table, formatting monospaced text, ...). In those existing 
> cases the `string-width` function is often used in combination with 
> `substring`, i.e., `(string-width (substring str beg end)`.
> 
> Therefore I would be happy with the following resolution:
> 
> 1. Add two arguments begin and end to `string-width` to improve the 
> current uses of `string-width`.
> 
> 2. Document the caveats of `string-width` in the docstring (works only 
> reliable in text mode for multi-width chars) and maybe mention 
> `window-text-pixel-size` or the `string-pixel-width` function by Martin.

Your wishes have been granted, see the latest master branch.

Is there anything else to do with this bug report, or can we close it?




This bug report was last modified 4 years and 38 days ago.

Previous Next


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