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?
Copy & Paste from the original messed up indentation ;-) I can fix this if it's clear we want to merge

Thanks for taking a look @dequis