GNU bug report logs -
#52237
29.0.50; [PATCH] Doubled separators in context-menu-mode
Previous Next
Reported by: Jim Porter <jporterbugs <at> gmail.com>
Date: Thu, 2 Dec 2021 06:07:01 UTC
Severity: normal
Tags: moreinfo, patch
Found in version 29.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Sometimes, menu separators are doubled up in context-menu-mode. To see
this in action:
emacs -Q --eval '(context-menu-mode)'
;; Right-click somewhere in the scratch buffer, like the empty area.
You should see a double separator just before "Lisp-Interaction".
`context-menu-map' tries to eliminate doubled separators, but it doesn't
account for *tripled* separators. If we have a menu like so ("->" is the
current list item when iterating):
-> (separator-foo "--")
(separator-bar "--")
(separator-baz "--")
(regular-item "Item")
The duplicate remover sees that both the current item and the next are
separators, so removes it:
-> (separator-foo "--")
(separator-baz "--")
(regular-item "Item")
But then the very next operation is to move to the next list item:
(separator-foo "--")
-> (separator-baz "--")
(regular-item "Item")
Now, on the next iteration of the while loop, it won't detect the
duplicate because it's too far ahead. Attached is a patch to fix this;
it only advances to the next list item when it *didn't* just delete a
duplicate separator. That way, it can keep deleting subsequent dupes
until it sees a non-separator item.
I've only tested this on Emacs 29 so far, but it may occur on Emacs 28
as well. Also, I noticed that separators can appear at the beginning
and/or end of the context menu. Should they be removed too?
[0001-Ensure-there-are-no-duplicate-separators-when-creati.patch (text/plain, attachment)]
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.