reimplement format and length logic for the entry prompt

a rather complicated fix for a small issue http://bugs.irssi.org/index.php?do=details&task_id=782

maybe someone has a better idea?
:warning: Spaces for indentation