Detect abnormal exit when loading plug-ins

Currently we ask user about skipping it, but it might make sense to also add an uninstall option.
Avoid using Application Support for temporary file

Since the user’s library folder might be on a network we should probably avoid writing to it unless strictly necessary.
When clearing marked range, ensure pending range is also cleared

This fixes an issue with complex input managers.

Using Chinese pinyin input and entering ‘ci’ followed by ‘1’ to insert first glyph would insert the glyph (‘刺’) and then set the pending marked range (0-2), which would have caret end up in the middle of a multi-byte sequence.