Adds onModeLoaded global event.
Support multi-window & multi-files

Seems a bit buggy though.
Fix a bug for appending new tokens at the end of a line.
Fix misc bugs around contents.
Fix bug of menu-handler continue missing items.
Fix editing bugs.