delphidabbler / codesnip

A code bank designed with Pascal in mind
https://delphidabbler.com/software/codesnip
Other
110 stars 33 forks source link

Tests for `IActiveText.IsEmpty` is not reliable #102

Closed delphidabbler closed 1 year ago

delphidabbler commented 1 year ago

Simply testing IActiveTest.IsEmpty is no longer sufficient for checking if an active text object has any true content.

For example active text that comprises only of a pair of matched ekDocument elements has no content but IsEmpty returns false for this document.

It is suggested that a new method, IActiveText.HasContent is provided that checks of the active text truly has content. Implementations should scan the active text for an occurrence of any text element and return True if a text element is found and false otherwise.

Because IsEmpty is no longer sufficient spurious output is occuring, for example in TTextSnippetDoc.RenderExtra where empty lines are being emitted where none are required.

delphidabbler commented 1 year ago

Fixed at merge commit 8651929d6de7158dbfd605c62258c7b86c44260c

delphidabbler commented 1 year ago

This is a fix to changes made since last release → no need to put in change log.