fix another cursesport bug

Check valid cursor after newline and check return value of newline()
Merge pull request #8145 from BevapDin/another-curses-fix

fix another cursesport bug