editor: Merge key event handling refactorings