Fix cursor location on Mac OS X; add flake8 compliance.