fix: fixes #127, keeping blocks and indexes in sync
Issue #, if available:
fixes #127
Description of changes:
Fixing delete_blocks, which deleted lower index numbers, which shifted the items and then deleted the wrong indexes
Fixing adding update of indexes after add_blocks
Fixing block ordering, which updates the index now as well
all tests work, but the design has a problem with keeping the index and the blocks array in sync. Python does not have a listener for array changes, so this is still a potential for failure if someone manipulates the TDocument.blocks array without calling __post_init__().
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #, if available: fixes #127
Description of changes: Fixing delete_blocks, which deleted lower index numbers, which shifted the items and then deleted the wrong indexes Fixing adding update of indexes after add_blocks Fixing block ordering, which updates the index now as well
all tests work, but the design has a problem with keeping the index and the blocks array in sync. Python does not have a listener for array changes, so this is still a potential for failure if someone manipulates the TDocument.blocks array without calling __post_init__().
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.