sort keys in editor, partially fix #3
small selection handling fix