I just tried this, and it seems just ~. works fine (no newline needed).
"The escape character is only recognized at the beginning of a line."
so you'll generally need that newline to allow the escape to be detected, even though it's not technically part of the sequence.
I just tried this, and it seems just ~. works fine (no newline needed).