Fixed behavior of Begin and End keys on Mac

Fixed #556

review: @devoncarew