This project is read-only.

TextEditorLibrary 3.0

Rating: No reviews yet
Downloads: 132
Released: Aug 12, 2014
Updated: Aug 12, 2014 by Bodgel
Dev status: Stable Help Icon

Recommended Download

Application TEL.dll
application, 64K, uploaded Aug 12, 2014 - 82 downloads

Other Available Downloads

Application TEL.pdb
application, 126K, uploaded Aug 12, 2014 - 19 downloads
Documentation TEL.html
documentation, 135K, uploaded Aug 12, 2014 - 31 downloads

Release Notes

Breaking Changes
  • To support access to very large files, the following properties, methods and operators return long values: Text.Length, Mark.Offset(), Mark.Offset(Mark), Mark - Mark, Range.Length().
  • Text.AddRange() returns an empty Range at the start of the Text, instead of a Range containing the whole Text.
Bug Fixes
  • Correction for the value returned by Text.GetHashCode() - the value could be non-unique if both empty and non-empty Texts were created in one session.
  • Reliable disposal of file and stream resources when an exception occurs.
  • Support for very large files (more than 4GiB). The following properties, methods and operators accept long arguments: Text[index], Text.AddRange(offset), Text.MoveTo(offset), Text.Delete(chars), Mark.MoveTo(offset), Mark.Delete(chars), Mark + offset, Mark - offset, Range[index].
  • New options for timing of data load from file (enum DataLoad) in the Text constructor:
    • Immediate - backwards-compatible default, which loads the whole file into memory before returning.
    • Background - the whole file is loaded sequentially in a background thread while the main thread waits only for accessed data to become available.
    • OnDemand - blocks are randomly accessed as required and discarded if not edited. This option requires the file to be seekable and to have fixed-length encoding. Since characters outside Unicode Plane 0 are not supported, this includes all single-byte encodings plus UTF-16 and UTF-32, in either byte order. For efficiency, the next block is always prospectively pre-loaded in a background thread if it is not already available.
  • A file path passed to a Text constructor is opened with FileAccess and FileShare set to Read to allow concurrent read access.
  • Carriage return characters (\r) in text files and streams are removed in the Text constructor by default. A new bool argument removeCR allows carriage returns to be left in.
  • Text implements IDisposable, so you can employ the using pattern, or call Text.Dispose() to ensure that background threads and file streams are closed. The text data and other private objects are released for garbage collection.
  • Improved efficiency of char data manipulation based on timing tests. Given a StringBuilder, some operations (moving text) are quicker via ToString(), while others (searching) are quicker with indexing directly into the StringBuilder.
  • Reorganisation of the source code with separate Mark.cs and Range.cs files.
The use of alternative data loading strategies raises a couple of performance issues. In Background mode, using Text.End or Text.Length requires the whole file to be read before the property can return a value. There is no benefit in using Background mode when you are working only at the end of the file.

In OnDemand mode, Text.End can return after reading at most one block. If carriage returns are removed, then Text.Length, Range.Length() and any method which uses an offset will need all intermediate blocks to have been read at some point in order to know their adjusted length. (Once a block has been read, its adjusted length is stored, so it will only be read again if its contents are required.) If carriage returns are not removed, then these methods will always return without any extra reads, since the size on disk scales directly to the size in memory.

In either case, the effect of edits on the length of the whole Text are accounted for separately, so subsequent calls to Text.Length can always return immediately.

In OnDemand mode, blocks of text are released for garbage collection so long as they have not been changed, with only about 1MB of releasable blocks held in a FIFO queue. If a block is needed after release, it is likely to remain available in the system cache while the file remains open, unless the cache is filled. Once the text in a block has been edited, it remains permanently in memory. To make a very large number of changes to a very large file, you may need to save and reload intermediate versions of the file.

Reviews for this release

No reviews yet for this release.