IDIOMS

think on one's feet

(idiomatic) When one is in the middle of a process, activity, or conversation, to adjust rapidly, effectively, and intelligently to new developments or changing circumstances.

Example: 1901, Henry B. Fuller, Under the Skylights, ch. 24:
  "There will be wine," said Medora. "Drink it. There may be toasts. Be ready to respond."
  Abner could think on his feet—speech would not fail.
c. 1919, Elbert Hubbard, Little Journeys, Volume 9: Great Reformers, "Richard Cobden":
  The political canvass had given freedom to his wings; he had learned to think on his feet, to meet interruption, to parry in debate.
2007 Sept. 16, Karen Crouse, "Covering New Ground, Jets’ Clemens Relies on Deep Roots ," New York Times (retrieved 7 Nov 2011):
  Clemens had to think on his feet, adjust on the run, make split-second decisions and, if he messed up, contend with the consequences.