After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 155948 - Preserve normalization for backspace-deletes-character
Preserve normalization for backspace-deletes-character
Status: RESOLVED OBSOLETE
Product: pango
Classification: Platform
Component: general
unspecified
Other Linux
: Normal minor
: Medium API
Assigned To: Behdad Esfahbod
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-10-20 14:52 UTC by Owen Taylor
Modified: 2018-05-22 12:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (2.90 KB, patch)
2005-03-13 13:42 UTC, Theppitak Karoonboonyanan
none Details | Review

Description Owen Taylor 2004-10-20 14:52:31 UTC
In the mythical lost original backspace-deletes-character patch
for GtkTextView and GtkEntry, what I did was:

     normalized_text = g_utf8_normalize (cluster_text, -1, G_NORMALIZE_NFD);
    gboolean recompose = strcmp (normalized_text, cluster_text) != 0;
     len = g_utf8_strlen (cluster_text, -1);

     if (len > 1) 
      {
         int bytelen = g_utf8_offset_to_pointer (normalized_text, len - 1) -
normalized_text;
         char *to_insert;
         if (recompose)
           to_insert = g_utf8_normalize (cluster_text, bytelen, G_NORMALIZE_NFC);
         else
           to_insert = g_strndup (cluster_text, bytelen);

         /* insert text */

        g_free (to_insert);
       }
     g_free (normalized_text);
        
     
This avoids a bug where deleting one accent off a precomposed form
with two accents will give a decomposed form.
Comment 1 Theppitak Karoonboonyanan 2005-03-13 08:04:23 UTC
>         if (recompose)
>           to_insert = g_utf8_normalize (cluster_text, bytelen, G_NORMALIZE_NFC);
>         else
>           to_insert = g_strndup (cluster_text, bytelen);

Did you mean 's/cluster_text/normalized_text/'?
Comment 2 Owen Taylor 2005-03-13 13:15:39 UTC
Yes.
Comment 3 Theppitak Karoonboonyanan 2005-03-13 13:42:57 UTC
Created attachment 38640 [details] [review]
Proposed patch

So, please consider the proposed patch. However, I wonder how to test the case,
i.e. which scripts fall in the category. Not Latin/Greek/Cyrillic, at least.
Comment 4 Matthias Clasen 2005-07-20 23:41:28 UTC
Owen, do you have a text snipplet to test this patch with ?
Comment 5 Owen Taylor 2005-07-21 13:42:40 UTC
Here's one that should test out this code:

 U+9DF U+9BE (য়া)

Hitting delete after that should turn it into U+9DF, not it's
decomposition:

 U+9AF U+9BC
Comment 6 Behdad Esfahbod 2007-03-03 03:44:21 UTC
I'm going to add API to Pango to handle backspace deletions.  I'll take care of this there and make Gtk+ use that.
Comment 7 GNOME Infrastructure Team 2018-05-22 12:06:44 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pango/issues/19.