Remove the last newline in a visual replacement

Fixes #178