Miscellaneous Unicode bugfixes and optimizations

This patch series contains various bug fixes for combining character and East Asian wide character support, notably:
* The second crash reported in #145
* Text is rendered incorrectly (characters are drawn on top of one another) if the cursor is moved into the middle of a line with many East Asian wide characters; in extreme cases, the cursor can disappear entirely (regression caused by 9f1d71b and not addressed by e69a1b4)
* Combining diacritics in the last column of the screen or at the end of a selection weren't displayed

There are also additional test cases for Unicode support and a couple of small performance improvements.

Lightly tested on various emulators; in addition, most of these patches have been running for some time on a phone running 4.4 without problems.