Refactor key movement handlers in IText