Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335704 - [Forms] Copying text from a FormText copies to much in some cases.
Summary: [Forms] Copying text from a FormText copies to much in some cases.
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.6.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Chris Goldthorpe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-28 11:52 EST by riesem CLA
Modified: 2011-02-02 14:58 EST (History)
4 users (show)

See Also:


Attachments
Example code (1.09 KB, application/octet-stream)
2011-01-28 11:53 EST, riesem CLA
no flags Details
Patch (804 bytes, patch)
2011-02-02 14:57 EST, Chris Goldthorpe CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description riesem CLA 2011-01-28 11:52:14 EST
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'
Comment 1 riesem CLA 2011-01-28 11:53:52 EST
Created attachment 187855 [details]
Example code
Comment 2 Chris Goldthorpe CLA 2011-02-02 14:45:37 EST
I agree with your suggested change to the code. It is too late to get this into 3.6.2 but I will get the fix into Eclipse 3.7 if no problems are discovered in testing.
Comment 3 Chris Goldthorpe CLA 2011-02-02 14:57:32 EST
Created attachment 188184 [details]
Patch
Comment 4 Chris Goldthorpe CLA 2011-02-02 14:58:30 EST
Patch applied to HEAD, Fixed.