Resynchronize the window selection on any local cursor update

The window selection should be synchronised every time the local user's
cursor is moved. When the local user's selection is modified using the
keyboard, the event trap never loses focus, so the focus event is not
fired, meaning the window selection was not being reset.

Now, the local cursor's update event is directly subscribed to, and if
the document has focus, the window selection is reset. Note, if the
document does not have focus, no reset will occur to prevent focus
stealing.

Fixes a regression introduced in 8de8dde.
Merge pull request #520 from peitschie/selection-sync

Resynchronize the window selection on any local cursor update
Fix crash in utf8ByteArrayToString when opening UTF8 heavy docs

UTF8 allows double-byte chars (as shown in the loop handling behaviour).
This means that it's possible for the number of chars to never be exactly
1000. E.g., a double-byte char is added after there are 999 chars. If this
happens, the char length will never flush until the function returns, at
which point too many arguments are passed into the apply invocation and
a maximum stack size error will be thrown.

There is no measurable performance from this change (tested @ 1000pages.odt)
Merge pull request #541 from peitschie/length-fix

Fix crash in utf8ByteArrayToString when opening UTF8 heavy docs
Fix: disable annotation creation key combo in collab editor