Bug 335704 [Forms] Copying text from a FormText copies to much in some cases.
Build Identifier: 3.6.1.v3659 In TextForms that use HTML tags for formatting the text is split up in segments of the same formatting. If a line consists of more than one segment, selecting and copying text from this line causes all segments preceding the selected text to be copied as well. PATCH: I think the bug is in TextSegment.computeSelection. The first if-condition in the method should be "(firstRow && bounds.x < leftOffset)" instead of "(firstRow && bounds.x + swidth > leftOffset)". This way sstart would be set to s.length and no text would be added to the selection. I am not set up to build Eclipse or SWT right now so I could not test the code. Could this also be nominated for inclusion in 3.6.2? We are planning to releasing an RCP app based on 3.6.2. Unfortunately, I am unable to wait to the release of 3.7.0. Reproducible: Always Steps to Reproduce: 1. Create a new Plug-in project in eclipse. Use the 'RCP Application with a view' as template. 2. Replace the code in view.java with the attached file and adjust the package 3. Run the application 4. Copy the word 'normal' form the TextForm 5. Paste it to any text editor. 6. The copied text is 'Boldnormal'
bundles/org.eclipse.ui.forms/src/org/eclipse/ui/internal/forms/widgets/TextSegment.java
/*******************************************************************************
 * Copyright (c) 2000, 2011 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Konstantin Komissarchik - Fix for  Bug 316997 
 *******************************************************************************/
package org.eclipse.ui.internal.forms.widgets;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Vector;
import org.eclipse.jface.util.Geometry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import com.ibm.icu.text.BreakIterator;
/**
 * @version 1.0
 * @author
 */
public class TextSegment extends ParagraphSegment {