From a5e86c649b3e2912e97f189a0b50042e4557b820 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke <marijnh@gmail.com>
Date: Fri, 2 Nov 2012 10:08:12 +0100
Subject: [PATCH] Clear the measureLine cache when refresh() is called

So that one can change the font size, call refresh, and
not have old cached measurements cause artifacts.

Closes #922
---
 lib/codemirror.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/codemirror.js b/lib/codemirror.js
index 5b584c83..deadf63a 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -2655,7 +2655,8 @@ window.CodeMirror = (function() {
     operation: function(f){return operation(this, f)();},
     compoundChange: function(f){return compoundChange(this, f);},
 
-    refresh: function(){
+    refresh: function() {
+      this.display.measureLineCache.length = 0;
       updateDisplay(this, true, this.view.scrollTop);
       if (this.display.scrollbarV.scrollHeight > this.view.scrollTop)
         this.display.scrollbarV.scrollTop = this.view.scrollTop;
-- 
GitLab