Don’t crash when the region is outside the underlying string.

This re-instates behaviour from before the API work.

Fixed #1002302
Merge pull request #837 from dragos/issue/semantic-highlighting-crash

Don’t crash when the region is outside the underlying string.
Make project close and plugin shutdown save (scala) project-specific preference stores as well.

Fixes #1002304, #1002243
Merge pull request #838 from huitseeker/issue/1002304

Project close & plugin shutdown save project-specific preference stores
Add link to starter tickets.