Fix Enter erroring due to broken 'enter' handler #ImAnIdiot
Factor out handlers to Controller #simplify

Using better, more reliable strategy to determine whether to pass along
`dir` or not, which deals with smell of checking the index of the loop:
https://github.com/mathquill/mathquill/pull/351#issuecomment-62074898
Merge pull request #353 from mathquill/fix.enter-handler

Fix Enter erroring due to broken 'enter' handler #ImAnIdiot