You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Harbs <ha...@gmail.com> on 2014/10/05 09:45:03 UTC

Delete text operation and para terminators

The handling of paragraph terminators in TLF is proving to be a huge PITA… I can’t tell you how many hours I have spent tracking down odd issues related to tracking terminators. The whole concept that paragraph terminators are not “real” content is convoluted to start with. Couldn’t this have been designed a bit better?

Currently I have the following problem.

When a paragraph terminator is deleted, I’m having an issue where nothing happens. I tracked the problem down to TextFlowEdit.deleteRangeInternal(). I think the terminator is regenerating itself. The thing is, I’m not sure what I changed about the code that’s making this happen.

Does anyone have a clue what’s supposed to happen when deleting a paragraph terminator? How is the merge with the next paragraph supposed to happen?

Harbs

Re: Delete text operation and para terminators

Posted by Harbs <ha...@gmail.com>.
To continue this monolog…

I’m changing TextFlowEdit.removeEmptyParentChain() to remove empty paragraph terminators as part of the process. I added a function to ParagraphElement to remove empty terminators. If the terminator is not specifically removed, the terminator will always automatically be re-added (more aggressively than it used to).

I hope this doesn’t cause issues for client code (it does not seem to cause issues for my client code), but the existing behavior has been highly unpredictable.

If anyone sees problems with my approach, please speak up now!

On Oct 5, 2014, at 11:16 AM, Harbs <ha...@gmail.com> wrote:

> Some more research shows that the non-replacement is normal. The paragraph is then supposed to be merged, but that failed because there was a terminator span. The terminator span got generated due to a change I made in ensureTerminatorAfterReplace(). Of course, reverting my change causes a runtime error in splitting paragraphs… :-(
> 
> I’ve taken to handling terminator spans as special cases when necessary. I might do that here as well…
> 
> On Oct 5, 2014, at 10:52 AM, Harbs <ha...@gmail.com> wrote:
> 
>>> I think the terminator is regenerating itself.
>> 
>> That’s not precise. The problem is actually in SpanElement.replaceText() where the relativeEndPosition is reduced for terminators so nothing is actually deleted…
>> 
>> A tiny bit of commenting in the code how terminators are supposed to work would have made my life a whole lot easier… :-(
>> 
>> On Oct 5, 2014, at 10:45 AM, Harbs <ha...@gmail.com> wrote:
>> 
>>> The handling of paragraph terminators in TLF is proving to be a huge PITA… I can’t tell you how many hours I have spent tracking down odd issues related to tracking terminators. The whole concept that paragraph terminators are not “real” content is convoluted to start with. Couldn’t this have been designed a bit better?
>>> 
>>> Currently I have the following problem.
>>> 
>>> When a paragraph terminator is deleted, I’m having an issue where nothing happens. I tracked the problem down to TextFlowEdit.deleteRangeInternal(). I think the terminator is regenerating itself. The thing is, I’m not sure what I changed about the code that’s making this happen.
>>> 
>>> Does anyone have a clue what’s supposed to happen when deleting a paragraph terminator? How is the merge with the next paragraph supposed to happen?
>>> 
>>> Harbs
>> 
> 


Re: Delete text operation and para terminators

Posted by Harbs <ha...@gmail.com>.
Some more research shows that the non-replacement is normal. The paragraph is then supposed to be merged, but that failed because there was a terminator span. The terminator span got generated due to a change I made in ensureTerminatorAfterReplace(). Of course, reverting my change causes a runtime error in splitting paragraphs… :-(

I’ve taken to handling terminator spans as special cases when necessary. I might do that here as well…

On Oct 5, 2014, at 10:52 AM, Harbs <ha...@gmail.com> wrote:

>> I think the terminator is regenerating itself.
> 
> That’s not precise. The problem is actually in SpanElement.replaceText() where the relativeEndPosition is reduced for terminators so nothing is actually deleted…
> 
> A tiny bit of commenting in the code how terminators are supposed to work would have made my life a whole lot easier… :-(
> 
> On Oct 5, 2014, at 10:45 AM, Harbs <ha...@gmail.com> wrote:
> 
>> The handling of paragraph terminators in TLF is proving to be a huge PITA… I can’t tell you how many hours I have spent tracking down odd issues related to tracking terminators. The whole concept that paragraph terminators are not “real” content is convoluted to start with. Couldn’t this have been designed a bit better?
>> 
>> Currently I have the following problem.
>> 
>> When a paragraph terminator is deleted, I’m having an issue where nothing happens. I tracked the problem down to TextFlowEdit.deleteRangeInternal(). I think the terminator is regenerating itself. The thing is, I’m not sure what I changed about the code that’s making this happen.
>> 
>> Does anyone have a clue what’s supposed to happen when deleting a paragraph terminator? How is the merge with the next paragraph supposed to happen?
>> 
>> Harbs
> 


Re: Delete text operation and para terminators

Posted by Harbs <ha...@gmail.com>.
> I think the terminator is regenerating itself.

That’s not precise. The problem is actually in SpanElement.replaceText() where the relativeEndPosition is reduced for terminators so nothing is actually deleted…

A tiny bit of commenting in the code how terminators are supposed to work would have made my life a whole lot easier… :-(

On Oct 5, 2014, at 10:45 AM, Harbs <ha...@gmail.com> wrote:

> The handling of paragraph terminators in TLF is proving to be a huge PITA… I can’t tell you how many hours I have spent tracking down odd issues related to tracking terminators. The whole concept that paragraph terminators are not “real” content is convoluted to start with. Couldn’t this have been designed a bit better?
> 
> Currently I have the following problem.
> 
> When a paragraph terminator is deleted, I’m having an issue where nothing happens. I tracked the problem down to TextFlowEdit.deleteRangeInternal(). I think the terminator is regenerating itself. The thing is, I’m not sure what I changed about the code that’s making this happen.
> 
> Does anyone have a clue what’s supposed to happen when deleting a paragraph terminator? How is the merge with the next paragraph supposed to happen?
> 
> Harbs