(count: number)
| 216 | }; |
| 217 | |
| 218 | const applyUndo = (count: number): void => { |
| 219 | if (count <= 0) return; |
| 220 | let removedUserCount = 0; |
| 221 | for (let i = transcript.length - 1; i >= clearFloor; i--) { |
| 222 | const message = transcript[i]!.message; |
| 223 | if (message.origin?.kind === 'injection') continue; |
| 224 | if (message.origin?.kind === 'compaction_summary') break; |
| 225 | transcript.splice(i, 1); |
| 226 | foldedLength = Math.max(0, foldedLength - 1); |
| 227 | if (isRealUserInput(message)) { |
| 228 | removedUserCount++; |
| 229 | if (removedUserCount >= count) break; |
| 230 | } |
| 231 | } |
| 232 | resetOpenState(); |
| 233 | }; |
| 234 | |
| 235 | for (const record of records) { |
| 236 | switch (record.type) { |
no test coverage detected