It was measuring the text to try to determine the size that it needed to
scale the emoji character to. Unfortunately it was accidentally trying
to measure the character under the cursor instead of the emoji character
itself, which is wrong, but more seriously doesn't work at all when the
cursor is at the end of the line.
This was already fixed before in change 144474, but that change never got
merged over to donut. So this merges it now.
Bug 2087915
Change-Id: Ib4804d330a029a966207b3b07271f84e6b2652c0