callable key handler can take buf parameter
refactor selection transform