me, tooJosef Templ wrote:Is anybody else working on this?
Fold expansion is wrong when clicked on |+>
Re: Fold expansion is wrong when clicked on |+>
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: Fold expansion is wrong when clicked on |+>
luowy, let me know if you want to solve the puzzle yourself or
if I should post my findings.
This bug is pretty hard from what I have seen so far
and I don't have a solution yet but at least it can be explained.
- Josef
if I should post my findings.
This bug is pretty hard from what I have seen so far
and I don't have a solution yet but at least it can be explained.
- Josef
Re: Fold expansion is wrong when clicked on |+>
I have traced to TextViews.ShowRangeIn, Is that Right? it dont worked well when use 1.7's CalcSize proc,the old can.
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: Fold expansion is wrong when clicked on |+>
Right.
It is a bug in the framework, not in StdFolds.
StdFolds correctly calls TextViews.ShowRange. There is no change over 1.6 in this code.
The bug appears only if the size of the open and closed fold views is the same,
which is the case in 1.7 but not in 1.6. If you use the same characters in 1.6
for both states the bug also appears.
There is a tricky mechanism behind the bug: lazy auto-scrolling.
If you insert into a text, the text is not scrolled to the end of the insertion immediately but the text's controller
sets an auto scroll range. When the next tick message arrives at that view, the
scrolling to this range is done, i.e. at a later time. This behavior is in conflict with ShowRange.
It scrolls to the auto scroll range even if ShowRange has been executed after the insertion. In other words:
ShowRange does not clear the auto scroll range.
This is the bug in the framework, I believe.
Why does this bug not appear in 1.6 StdFolds or, as Bernhard observed, when the fold is not empty?
Because the auto scroll position is cleared automatically if there are multiple text operations that have
incompatible ranges to show. In this case the controller clears the auto scroll position automatically
and no conflicting auto scroll appears.
When the fold expansion deletes some text because the fold was not empty or if a
fold view changes its size this is a text operation executed in addition to the insertion of the hidden text
and this additional text operation has a range that is incompatible with the previously set auto scroll range.
Therefore the auto scroll range is cleared and there is no bug observed.
- Josef
It is a bug in the framework, not in StdFolds.
StdFolds correctly calls TextViews.ShowRange. There is no change over 1.6 in this code.
The bug appears only if the size of the open and closed fold views is the same,
which is the case in 1.7 but not in 1.6. If you use the same characters in 1.6
for both states the bug also appears.
There is a tricky mechanism behind the bug: lazy auto-scrolling.
If you insert into a text, the text is not scrolled to the end of the insertion immediately but the text's controller
sets an auto scroll range. When the next tick message arrives at that view, the
scrolling to this range is done, i.e. at a later time. This behavior is in conflict with ShowRange.
It scrolls to the auto scroll range even if ShowRange has been executed after the insertion. In other words:
ShowRange does not clear the auto scroll range.
This is the bug in the framework, I believe.
Why does this bug not appear in 1.6 StdFolds or, as Bernhard observed, when the fold is not empty?
Because the auto scroll position is cleared automatically if there are multiple text operations that have
incompatible ranges to show. In this case the controller clears the auto scroll position automatically
and no conflicting auto scroll appears.
When the fold expansion deletes some text because the fold was not empty or if a
fold view changes its size this is a text operation executed in addition to the insertion of the hidden text
and this additional text operation has a range that is incompatible with the previously set auto scroll range.
Therefore the auto scroll range is cleared and there is no bug observed.
- Josef
Last edited by Josef Templ on Fri Sep 02, 2016 6:50 pm, edited 1 time in total.
Re: Fold expansion is wrong when clicked on |+>
absolutely right! I have checked it.Josef Templ wrote:auto scroll range.
-
- Posts: 1700
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Russia