When a new edit-line is created, and we move away from this line, then the line is added to the existing edit-regions. However, it is not possible simply to *add *this new region. What happens is:
The existing edit regions are retrieved into a new list using get_regions();
The new edited region is added to this new (temporary) list using append();
This list is iterated (in sorted order) to collapse any adjoining or overlapping regions;
The existing edit-regions are deleted (using erase_regions()) and re-created (from scratch!) using add_regions().
To maintain two distinct (saved and not-yet-saved regions) would require (after a line is edited):
Grab both sets of regions (and the new region);
Merge these to a new list in sorted order;
Iterate this list, merging any that are adjoining or overlap, but *only *if they belong to the same set - saved or not-yet saved;
Split this list into two so that the region-sets saved and not-yet-saved can be reinstated.
A similar process would be necessary in order to produce the jump-lists. That is, to create jump-lists that appear in file-order, but still distinguish between saved and non-saved regions.
Another slight complication is to decide how to handle saved regions that overlap with non-saved regions.
Multiple-undo/redo behaves quite well currently - it took a bit of effort to control this behaviour . Their behaviour would need to be re-examined when there are two types of regions to maintain, and it may not be possible to control their behaviour to an acceptable level.
Ideas occurred to me to either collapse saved-regions to a single edit point, or to insert hidden content , but I doubt that either of these options are workable.
So I’m afraid I’m going to leave “as is” for the moment and concentrate on resolving any issues that arise/handling minor change requests. Of course, anyone is welcome to clone/fork my code and work on your suggestion .
Hope you’re not too disappointed; Andy.