auto expand folded regions when fold ranges become invalid

This addresses an issue where fold markers do nothing if a folded region is made invalid  as a result of an undo or delete action. To reproduce:
* Enter the following fragment
```javascript
function () {

}
```
* Fold the function
* Delete the closing brace

Result is that the fold marker no longer expands the folded region, although one is still able to click text marker or indeed expand the fold by navigating the cursor into the region.

In an attempt to address this issue, this pull request expands a folded region when they become invalid.
Credits to @JeffryBooher for spotting the issue.