fix undo bug leaving extra junk text. use new way to bind keys by file grammar