
I have been working on a patch for bug: https://bugs.launchpad.net/inkscape/+bug/167904
sp_te_insert_line
I basically created a working patch (excluding end of string line breaks and probably spacing issues). The patch checks if the text in contained in a text box is a child of svg:text instead of svg:tspan . If this is true a <tspan> is inserted as a child of the <text> and the string is transfered to become a child of the <tspan> . this This works but it fails for strange reasons. If the text box is selected and the cursor is moved over with the keyboard and a line break is inserted, inkscape crashes. I traced this back to a problem occurring with the Glib::ustring::iterator s being used. In the instances that the patch fails the iterator's values don't match up to their expected value. The problem also occurs after a line break, an undo, and a repeat of the line break.
I'm fairly new to the code base so I may be doing things out of order or failing to call a necessary function. I'm not exactly sure why this is occurring after these actions are performed. What can I do to solve this issue. I have posted the code in question to the bug report. I have a feeling this problem is occurring from the layout obtained from the SPItem and the actions that occur afterwards. Thanks