all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Visuwesh <visuweshm@gmail.com>
Cc: 56237@debbugs.gnu.org
Subject: bug#56237: 29.0.50; delete-forward-char fails to delete character
Date: Mon, 27 Jun 2022 15:39:46 +0300	[thread overview]
Message-ID: <83fsjq8elp.fsf@gnu.org> (raw)
In-Reply-To: <87o7yeodxu.fsf@gmail.com> (message from Visuwesh on Mon, 27 Jun 2022 11:17:25 +0530)

> From: Visuwesh <visuweshm@gmail.com>
> Cc: 56237@debbugs.gnu.org
> Date: Mon, 27 Jun 2022 11:17:25 +0530
> 
> >     (let* ((composition (find-composition 0 nil "ப்போ" t))
> >            (gstring (nth 2 composition))
> >            (num-glyphs (lgstring-glyph-len gstring))
> >            (i 1)
> >            (from (lglyph-from (lgstring-glyph gstring 0)))
> >            (to (lglyph-to (lgstring-glyph gstring 0))))
> >       (while (and (< i num-glyphs)
> >                   (= from (lglyph-from (lgstring-glyph gstring i)))
> >                   (= to (lglyph-to (lgstring-glyph gstring i))))
> >         (setq i (1+ i)))
> >       i)
> >
> > here i is the number of characters we need to delete using delete-char.
> >
> > [1] For the gstring format, see composition-get-gstring.
> >
> > But I think we should test this code in cases where a grapheme cluster
> > contains more than two codepoints since all the composed characters in
> > Tamil are made up of two Unicode codepoints.  I can't test it on emojis
> > since I don't know of an Emoji font that won't crash potentially Xft and
> > has enough coverage.
> >
> 
> I got my hopes too high.  :(
> 
> This fails for the simple case of ரு (C-u C-x = also fails!) so I guess
> we are back to square one.  Although ரு is composed from 0BB0 0BC1, the
> gstring only has one glyph.

Yes, composition of N characters can in general produce M glyphs,
where M can be smaller, equal, or greater than N.  It's a many-to-many
operation, and we cannot rely on getting the same number of glyphs as
the number of codepoints we compose.

The idea is nevertheless correct (I had the same one), it just needs
some fine-tuning.  (And "C-x =" tries to solve a different problem:
how to match each glyph with a codepoint, and that problem is in
general insoluble, so it's a small wonder that it fails.)

Please try the latest master, I hope delete-forward-char now behaves
better.





  reply	other threads:[~2022-06-27 12:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-26 16:07 bug#56237: 29.0.50; delete-forward-char fails to delete character visuweshm
2022-06-26 16:13 ` Visuwesh
2022-06-26 16:18 ` Eli Zaretskii
2022-06-26 16:24   ` Lars Ingebrigtsen
2022-06-26 16:25   ` Visuwesh
2022-06-26 16:36     ` Eli Zaretskii
2022-06-26 16:47       ` Visuwesh
2022-06-26 16:57         ` Eli Zaretskii
2022-06-26 17:06           ` Visuwesh
2022-06-26 17:26             ` Eli Zaretskii
2022-06-26 18:01               ` Eli Zaretskii
2022-06-27  5:31               ` Visuwesh
2022-06-27  5:47                 ` Visuwesh
2022-06-27 12:39                   ` Eli Zaretskii [this message]
2022-06-27 14:24                     ` Visuwesh
2022-06-27 15:53                       ` Eli Zaretskii
2022-07-02  7:03                         ` Visuwesh
2022-07-16 12:50                           ` Visuwesh
2022-07-16 13:31                             ` Eli Zaretskii
2022-07-16 13:43                               ` Visuwesh
2022-06-26 16:38     ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83fsjq8elp.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=56237@debbugs.gnu.org \
    --cc=visuweshm@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.