go.crypto/ssh/terminal: fix crash when terminal narrower than prompt.

Previously, if the current line was "empty", resizes wouldn't trigger
repaints. However, the line can be empty when the prompt is non-empty
and the code would then panic after a resize because the cursor position
was outside of the terminal.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/158090043
1 file changed