There is a minor bug here, yes:
But… the user can work around it by typing whatever title you want. Long titles really are very bad anyway.
I am not against a PR to improve this, but I have a feeling it is going to be very very complicated.