(update: ViewUpdate)
| 306 | } |
| 307 | |
| 308 | update(update: ViewUpdate): void { |
| 309 | const { view, state } = update; |
| 310 | let needsRebuild = false; |
| 311 | |
| 312 | if (update.docChanged) { |
| 313 | this.decorations = this.decorations.map(update.changes); |
| 314 | this.lineCache.clear(); |
| 315 | needsRebuild = true; |
| 316 | } |
| 317 | |
| 318 | if (update.viewportChanged) { |
| 319 | needsRebuild = true; |
| 320 | } |
| 321 | |
| 322 | const currentTabSize = getTabSize(state); |
| 323 | const currentIndentUnit = getIndentUnitColumns(state); |
| 324 | const currentCharWidth = view.defaultCharacterWidth; |
| 325 | |
| 326 | if ( |
| 327 | currentTabSize !== this.lastTabSize || |
| 328 | currentIndentUnit !== this.lastIndentUnit |
| 329 | ) { |
| 330 | this.lastTabSize = currentTabSize; |
| 331 | this.lastIndentUnit = currentIndentUnit; |
| 332 | this.lineCache.clear(); |
| 333 | this.styleCache.clear(); |
| 334 | needsRebuild = true; |
| 335 | } |
| 336 | |
| 337 | if (currentCharWidth !== this.lastCharWidth) { |
| 338 | this.lastCharWidth = currentCharWidth; |
| 339 | this.styleCache.clear(); |
| 340 | needsRebuild = true; |
| 341 | } |
| 342 | |
| 343 | if (needsRebuild) { |
| 344 | this.decorations = buildDecorations( |
| 345 | view, |
| 346 | config, |
| 347 | this.lineCache, |
| 348 | this.styleCache, |
| 349 | ); |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | destroy(): void { |
| 354 | this.lineCache.clear(); |
no test coverage detected