Manually implement home/end keys in command box

This is to deal with popup, which doesn't implement them.