bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50752: 28.0.50; easy-menu-define lowers the menu-bar key


From: Lars Ingebrigtsen
Subject: bug#50752: 28.0.50; easy-menu-define lowers the menu-bar key
Date: Tue, 19 Oct 2021 14:07:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> What would you do instead?  It's a conundrum with no easy solutions.
> The original string could include non-ASCII bytes.

First of all, I think the code is just plain buggy:

  for (i = 0; i < size; i++)
    {
      ch = make_char_multibyte (SREF (obj, i));
      cased = case_single_character (ctx, ch);
      if (ch == cased)
        continue;
      cased = make_char_unibyte (cased);
      /* If the char can't be converted to a valid byte, just don't
         change it.  */
      if (SINGLE_BYTE_CHAR_P (cased))
        SSET (obj, i, cased);
    }

That make_char_unibyte makes SINGLE_BYTE_CHAR_P always return true,
doesn't it?  Uhm...  No, what happens to raw bytes...  Oh, yeah,
case_single_character doesn't work for raw bytes, so the "continue" is
always taken for those.

So the code is all kinds of confused, I think.

Second of all -- to handle this specific, very unusual case (i.e.,
downcasing a ascii character gets us a non-ascii character), when we
detect this issue, we should just abort this loop and call
do_casify_multibyte_string instead.

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]