Prevented cursor from exiting grid. Fixes #9.