Community
Participate
Working Groups
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.
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 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.
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?
In my attachment I was talking about VerifyListener when I was of course talking about PaintControlListener.
Created attachment 41221 [details] patch could verify if this patch fixes the problem you have.
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).
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.
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.
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
*** This bug has been marked as a duplicate of bug 195032 ***