You pressed undo, typed, and redo vanished
transcript
You type A. You type B. You press undo. B disappears from the text. Then you type C. And redo is greyed out. Why?
Every editor keeps two stacks. One for undo, one for redo. Both start empty. Undo moves the last edit to the redo stack. Redo moves it back. That's the whole mechanism: one command, moving between two stacks.
Type A, and type B. Both are on the undo stack. Redo is empty. Press undo. B moves to the redo stack. Now redo can bring it back. The text shows A. Type C. The editor pushes C on undo, and clears redo.
B was a step on a path. You left that path when you typed C. There is no way back. Replaying B onto a text that moved on would be wrong. So clear it.
Execute, push on undo, clear redo. Three small steps. Every time, in that order.
Full breakdown in the lecture.