GNU bug report logs - #79279
28.2; Combining characters cause formatting problems when showing CAP candidates

Previous Next

Package: emacs;

Reported by: Dmitry Safronov <saf.dmitry <at> gmail.com>

Date: Wed, 20 Aug 2025 15:45:02 UTC

Severity: normal

Found in version 28.2

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 79279 <at> debbugs.gnu.org, saf.dmitry <at> gmail.com, juri <at> linkov.net
Subject: bug#79279: 28.2; Combining characters cause formatting problems when showing CAP candidates
Date: Sat, 23 Aug 2025 15:59:30 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Juri Linkov <juri <at> linkov.net>,  saf.dmitry <at> gmail.com,
>   79279 <at> debbugs.gnu.org
> Date: Fri, 22 Aug 2025 03:38:02 -0400
> 
> >> The alternative is for us to always add a special character there,
> >> like ZWNJ or maybe invisible TAB, like we do in other places where we
> >> want to prevent character composition.
> > That would be The Right Thing to do, I think.
> 
> [ Sorry, sent it a bit precipitously. ]
> 
> In practice it's rare for completion candidates to start with combining
> characters, so it's maybe not a bad tradeoff to dump that burden on the
> few completion tables where we know it's more likely to occur.
> 
> Still, if it can be done cheaply enough in `minibuffer.el`, it's much
> better, because the poor souls writing those completion tables are
> unlikely to be familiar with the issue and how best to circumvent it.

AFAIU, the problem happens when we insert two strings one after the
other in completion--insert:

    ;; If `str' is a list that has 2 elements,
    ;; then the second element is a suffix annotation.
    ;; If `str' has 3 elements, then the second element
    ;; is a prefix, and the third element is a suffix.
    (let* ((prefix (when (nth 2 str) (nth 1 str)))
           (suffix (or (nth 2 str) (nth 1 str))))
      (when prefix
        (let ((beg (point))
              (end (progn (insert prefix) (point))))
          (add-text-properties beg end `(mouse-face nil completion--string ,(car str)))))
      (completion--insert (car str) group-fun)
      (let ((beg (point))
            (end (progn (insert suffix) (point))))

We could handle the problem there, I think.




This bug report was last modified 14 days ago.

Previous Next


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