preventdefault for keys, fix control.define bug, add change to history on tm.replace