Use visual-lines-mode instead of longlines-mode.