| 2369 | // When the window resizes, we need to refresh active editors. |
| 2370 | var resizeTimer; |
| 2371 | function onResize() { |
| 2372 | if (resizeTimer == null) resizeTimer = setTimeout(function() { |
| 2373 | resizeTimer = null; |
| 2374 | // Might be a text scaling operation, clear size caches. |
| 2375 | d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = knownScrollbarWidth = null; |
| 2376 | cm.setSize(); |
| 2377 | }, 100); |
| 2378 | } |
| 2379 | on(window, "resize", onResize); |
| 2380 | // The above handler holds on to the editor and its data |
| 2381 | // structures. Here we poll to unregister it when the editor is no |