This should be the number of characters, not the end position. This fixes an issue where we wouldn't coalesce insert actions together.
We can test internal apis in our testsuite now, so move the text history tests there, to have them run in ci.