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 402119 - Minor bug while editing text
Minor bug while editing text
Status: RESOLVED FIXED
Product: dia
Classification: Other
Component: general
0.96-pre3
Other Windows
: Normal blocker
: 0.96
Assigned To: Dia maintainers
Dia maintainers
: 402974 406175 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-01-29 14:47 UTC by Christian Ridderström
Modified: 2007-02-09 19:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Ridderström 2007-01-29 14:47:32 UTC
I've noticed two strange things when editing text.

Here is the first thing:
1. Open the diagram
        http://www.md.kth.se/~chr/dia/bug1.dia
2. Click on the text
3. Press END to get at the end
4. Press BACKSPACE to try and delete the last character

   Nothing happens, except it says that the diagram has been changed

5. Press BACKSPACE again.

   This time the last character is deleted.

The second thing I'm unfortunately unable to Here is the second thing:
Sometimes when I tried deleting the last character, some unprintable
characters showed up instead. I'm guessing they are unprintable as it looked
like a small box.

Unfortunately I'm not able to reproduce this consistenly, but I'm hoping the
first bug is related.
Comment 1 Dolores Alia de Saravia 2007-01-30 04:40:47 UTC
I opened that diagram: with Dia 0.96-pre3 and verified what Christian said.

 Cristian's diagram contains one Text with characters needing more than one byte.

My locale is Spanish; and the same happens with a Text with just two accented  letters 


After playing around writing and deleting ... I also observed characters I have not written and unexpedted changes of position 

Dia 0.95.1 works well.
Comment 2 Dolores Alia de Saravia 2007-01-30 15:07:54 UTC
It looks as if:
 after pressing the end key (if there are at least one charecter needing more than one byte) Dia pre3 believe text is longer than it is.
Even, some times, waning messages appear talking of position of inexisting characters:


my text was three accented o 
** (lt-dia:4153): WARNING **: Text at char 5 not valid


Christian detected this bug working in Windows; I verified it working with Suse 10.1 (app/run_dia.sh)
Comment 3 Lars Clausen 2007-02-03 18:13:25 UTC
If there's more than one non-ASCII character, there's more "invisible characters" at the end.

The problem appears to be that we use strlen where we should be using g_utf8_strlen.  However, replacing that in text.c leads to crashes on some diagrams, and not in an obvious way.  There may be issues with somebody having assumed a long time ago that one character == one byte.  This desparately needs fixing.
Comment 4 Lars Clausen 2007-02-03 18:39:02 UTC
Fiddled with it some more, and replaced only the appropriate strlen's with g_utf8_strlen().  Some places actually base allocation on strlen.
Comment 5 Lars Clausen 2007-02-03 18:41:57 UTC
Oh, BTW, thank you *very* much for reporting this.  It would have been an embarrasing bug to have to make a bugfix release for.
Comment 6 Lars Clausen 2007-02-03 18:48:21 UTC
*** Bug 402974 has been marked as a duplicate of this bug. ***
Comment 7 Lars Clausen 2007-02-09 19:21:24 UTC
*** Bug 406175 has been marked as a duplicate of this bug. ***