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 337653 - GtkTextBuffer: Split existing tags when pasting tich text
GtkTextBuffer: Split existing tags when pasting tich text
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-04-07 16:11 UTC by Michael Natterer
Modified: 2006-04-10 20:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch fixing the bug (6.48 KB, patch)
2006-04-07 16:12 UTC, Michael Natterer
committed Details | Review

Description Michael Natterer 2006-04-07 16:11:43 UTC
When pasting rich text, and there are tags active at the insertion
point, the pasted text will have these tags applied after pasting.
This is wrong since rich text copy&paste is meant to preserve
formatting, otherwise it would be useless and unpredictable.

The solution is to figure what tags are active at the insertion
iter, and split their ranges so that only the original text
before and after the pasted segment is affected by the tags.

Patch follows.
Comment 1 Michael Natterer 2006-04-07 16:12:34 UTC
Created attachment 62932 [details] [review]
Patch fixing the bug
Comment 2 Tim Janik 2006-04-07 16:44:02 UTC
thanks mitch. the patch looks good to me. aside from extra empty newlines within for(...\n...\n...) maybe ;)
Comment 3 Matthias Clasen 2006-04-08 03:54:33 UTC
Yes, looks good, technically. Stylistically, I agree with Tim on the newlines.
Comment 4 Michael Natterer 2006-04-10 20:39:41 UTC
Fixed in CVS, the mentioned newlines removed:

2006-04-10  Michael Natterer  <mitch@imendio.com>

	* gtk/gtktextbufferrichtext.c (gtk_text_buffer_deserialize):
	pasted rich text should not be affected by tags that are active at
	the insertion point. Therefore, remove and remember all active
	tags, and re-apply them left and right of the inserted text after
	pasting. Fixes bug #337653.