GNU bug report logs - #64440
30.0.50; [PATCH] Highlight on non toolkit menu bar items

Previous Next

Package: emacs;

Reported by: Manuel Giraud <manuel <at> ledu-giraud.fr>

Date: Mon, 3 Jul 2023 16:00:02 UTC

Severity: wishlist

Tags: patch

Found in version 30.0.50

Done: Po Lu <luangruo <at> yahoo.com>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: luangruo <at> yahoo.com, stefankangas <at> gmail.com, 64440 <at> debbugs.gnu.org
Subject: Re: bug#64440: 30.0.50; [PATCH] Highlight on non toolkit menu bar
 items
Date: Mon, 11 Sep 2023 22:12:47 +0300
> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
> Cc: luangruo <at> yahoo.com,  stefankangas <at> gmail.com,  64440 <at> debbugs.gnu.org
> Date: Mon, 11 Sep 2023 20:56:37 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> [...]
> 
> > Thanks.  That's what I imagined we have there.  So I guess considering
> > that a string ends where is SCHARS end is reasonable.
> >
> > But note that the above means you could also detect where each item
> > ends by looking for the glyph whose string position is -1.  So maybe
> > add an assertion there that the glyph after the last character has its
> > position as -1, in case we could have some complications there with
> > double-width characters or something.
> 
> What do you think of this:
> 
> +  /* Convert to pixels bounds.  */
> +  row = MATRIX_ROW (w->current_matrix, *vpos);
> +  *x_start = 0;
> +  for (i = 0; i < *h_start; ++i)
> +    *x_start += row->glyphs[TEXT_AREA][i].pixel_width;
> +
> +  *x_end = *x_start;
> +  for (i = *h_start; CHARPOS (row->glyphs[TEXT_AREA][i]) != -1; ++i)
> +    *x_end += row->glyphs[TEXT_AREA][i].pixel_width;

That's OK, but I think we should also make sure 'i' never exceeds the
value row->used[TEXT_AREA] - 1.  This is only important for the last
item, but still.

And I would also add an assertion that row->reversed_p is false.  We
don't currently support R2L menu bars, but if we ever do, the above
loops should go backwards in such glyph rows.




This bug report was last modified 1 year and 207 days ago.

Previous Next


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