Fix reset of `input-decode-map` when a terminal is deleted.

The variable `input-decode-map` is terminal local, so this binding is
only active if a frame is selected that is associated with that
specific terminal. However, when a terminal is being deleted then the
current frame is not necessarily associated with this terminal. So
resetting the variable from `delete-terminal-functions` hook sometimes
changed the variable associated with another frame/terminal (e.g. when
using several different terminals/frames with emacs client).

Now we do not reset the variable when a terminal is deleted (it's not
used anyway). If `evil-esc-mode` is disabled, we run through all
frames instead of all terminals now.

--HG--
extra : amend_source : 3e52c62beafae387c07572c0fb0de51957e779a0