Use wnoutrefresh, pnoutrefresh and doupdate

Issue #298
Merge branch 'master' into gmail