unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Paul Pogonyshev <pogonyshev@gmail.com>
Cc: 38191@debbugs.gnu.org
Subject: bug#38191: incorrect text properties in result of `format' with multibyte(?) characters
Date: Thu, 14 Nov 2019 06:30:30 +0100	[thread overview]
Message-ID: <87k183rpmx.fsf@gnus.org> (raw)
In-Reply-To: <CAG7Bpaqb8dypYo3uxvqdz-t1J1itCcAfvczTFJbKRp56jbs_5w@mail.gmail.com> (Paul Pogonyshev's message of "Wed, 13 Nov 2019 01:31:25 +0100")

Paul Pogonyshev <pogonyshev@gmail.com> writes:

> "Multibyte" is a guess, I don't really know the underlying reason.
>
> Examples:
>
> (format (propertize "`foo' %s bar" 'face 'bold) "xxx")
>   => #("`foo' xxx bar" 0 13 (face bold))
>
> (format (propertize "‘foo’ %s bar" 'face 'bold) "xxx")
>   => #("‘foo’ xxx bar" 0 10 (face bold))
>
> Length of the string is the same in both cases. In the first example
> the face is correctly applied to the whole string, in the second
> example 3 last characters incorrectly lack a face.
>
> This is a regression, it used to work correctly before, but I don't
> know when it became broken.

It's always off by the length of the inserted string, so it's at least
systematic:

(format (propertize "ççfoo %s bar" 'face 'bold) "xxx")
=> #("ççfoo xxx bar" 0 10 (face bold))

(format (propertize "ççfoo %s bar" 'face 'bold) "xxxx")
=> #("ççfoo xxxx bar" 0 10 (face bold))

It doesn't happen if there's just one multibyte character in the format
spec -- there has to be two or more.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2019-11-14  5:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13  0:31 bug#38191: incorrect text properties in result of `format' with multibyte(?) characters Paul Pogonyshev
2019-11-14  5:30 ` Lars Ingebrigtsen [this message]
2019-11-14 22:46 ` Paul Eggert

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=87k183rpmx.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=38191@debbugs.gnu.org \
    --cc=pogonyshev@gmail.com \
    /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).