When the indentation for the line is needed, i.e. when executing newlineAndIndent or indentAuto or calling indentLine.
Is a copy of the tokenizer state saved at the end of each line?
Not at the end of every line, but at the end of some lines, and such a state can be rolled forward by running the mode over the intermediate text.
Which src file contains the logic to determine when to save state and which to initiate a reparse?
Also, thanks for the help Marijn. You are an awesome maintainer!
src/line/highlight.js contains most of the state management logic. The indentation code is in src/input/indent.js.