fix #24: trailing spaces in wordwrap mode caused hangs