Fix bug #11035 with cursor positioning on overlay strings with newlines.