cancel last command if exists
cancel() { if (history.isEmpty) return; history.removeLast(); apply(); }