* Append to the eval instance and return an undo function.
(state: EvalState, input: string)
| 680 | * Append to the eval instance and return an undo function. |
| 681 | */ |
| 682 | function appendToEvalState(state: EvalState, input: string) { |
| 683 | const undoInput = state.input; |
| 684 | const undoVersion = state.version; |
| 685 | const undoOutput = state.output; |
| 686 | const undoLines = state.lines; |
| 687 | |
| 688 | state.input += input; |
| 689 | state.lines += lineCount(input); |
| 690 | state.version++; |
| 691 | |
| 692 | return function () { |
| 693 | state.input = undoInput; |
| 694 | state.output = undoOutput; |
| 695 | state.version = undoVersion; |
| 696 | state.lines = undoLines; |
| 697 | }; |
| 698 | } |
| 699 | |
| 700 | /** |
| 701 | * Count the number of lines. |
no test coverage detected
searching dependent graphs…