Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 135878 - [StyledText] StyledText moves children Composites when lines are entered or removed
Summary: [StyledText] StyledText moves children Composites when lines are entered or r...
Status: RESOLVED DUPLICATE of bug 195032
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Felipe Heidrich CLA
URL: http://phpfi.com/111847
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-10 09:55 EDT by Antti Kumpulainen CLA
Modified: 2009-08-21 17:04 EDT (History)
1 user (show)

See Also:


Attachments
A video clip of the problem with a description of the problem again (1.02 MB, application/x-shockwave-flash)
2006-05-11 03:47 EDT, Antti Kumpulainen CLA
no flags Details
patch (972 bytes, text/plain)
2006-05-11 16:16 EDT, Felipe Heidrich CLA
no flags Details
Patch to the problem I described (989 bytes, patch)
2006-05-30 17:54 EDT, Antti Kumpulainen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Kumpulainen CLA 2006-04-10 09:55:04 EDT
StyledText moves children Composites when new lines are entered or removed. If the child is earlier in the text and you enter a new line, it's not a wanted feature that they move down. Moving of children should be left to be done for example in a PaintObjectListener or VerifyListener. You can of course do that right now, but it causes ugly flashing. I can't see a situation where this would be a wanted feature.

I supplied URL to an example which you can use to verify this bug.
Comment 1 Felipe Heidrich CLA 2006-04-10 17:30:00 EDT
I'm not sure how to fix this. When the application add embed controls (see Snippet217) to StyledText it certanly wants these embed controls to move when the text scrolls (by adding lines, or scrollbar action).
I've no way to determine when the app wants this behaviour or not.
Comment 2 Antti Kumpulainen CLA 2006-04-11 02:31:45 EDT
(In reply to comment #1)
> I'm not sure how to fix this. When the application add embed controls (see
> Snippet217) to StyledText it certanly wants these embed controls to move when
> the text scrolls (by adding lines, or scrollbar action).
> I've no way to determine when the app wants this behaviour or not.
> 

In Snippet217 the application does move the controls itself inside PaintControlListener. The feature with StyledText that makes them move by themselves only makes those controls flash when entering lines or removing lines (first the StyledText moves them down or up and then PaintControlListener fixes their position). I have no problems with making them move how they are supposed to (I do the same thing as in Snippet217) but I can't use the feature if the controls flash every time I add a line or remove a line.
Comment 3 Antti Kumpulainen CLA 2006-05-11 03:47:23 EDT
Created attachment 41079 [details]
A video clip of the problem with a description of the problem again

I hope this video clip makes it easier to understand this bug. This video clip is made with the example that is in the URL of this bug just with some added text so it's more obvious that when you add or remove lines after the component the component will (falsely) move. It should not move at all no matter where the lines are added or removed! It doesn't move horizontally with the text, why should it move vertically?
Comment 4 Antti Kumpulainen CLA 2006-05-11 03:53:12 EDT
In my attachment I was talking about VerifyListener when I was of course talking about PaintControlListener.
Comment 5 Felipe Heidrich CLA 2006-05-11 16:16:49 EDT
Created attachment 41221 [details]
patch

could verify if this patch fixes the problem you have.
Comment 6 Felipe Heidrich CLA 2006-05-11 16:42:07 EDT
The patch is bad in carbon. There are lot of inconsistence involving scroll+redraw+children among the platforms. the test case actually works on carbon (it doesn't flash when you add lines).
Comment 7 Antti Kumpulainen CLA 2006-05-15 03:45:39 EDT
I believe I found the solution but I don't know how to test it (or change it) myself. In method scrollText() in StyledText there is a line (line 6478 in RC2)

scroll(leftMargin, destY, leftMargin, srcY, scrollWidth, scrollHeight, true);

which I believe should be

scroll(leftMargin, destY, leftMargin, srcY, scrollWidth, scrollHeight, false);

This way children don't get moved when text has changed. This is very necessary since as I already said several times, those children might be earlier in the text and they should not be moved down when lines are added or up when they get removed. Moving children should be left to be done in PaintObjectListener since that's the only real solution right now when there is no offset for objects in a StyledText.
Comment 8 Antti Kumpulainen CLA 2006-05-30 17:54:09 EDT
Created attachment 43029 [details]
Patch to the problem I described

This patch fixes the problem for me. Scrolling also works properly. Now moving the children is a task to be done in PaintControlListener (just like in Snippet217) without annoying flashing.
Comment 9 Felipe Heidrich CLA 2009-08-20 09:41:32 EDT
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
Comment 10 Felipe Heidrich CLA 2009-08-21 17:04:36 EDT

*** This bug has been marked as a duplicate of bug 195032 ***