From 93a15a8284344e768d4a9a43a1689903c88e6ee7 Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 1 Feb 2019 16:36:08 +0300 Subject: [PATCH] fix colorview detection with inline comments (#660) --- vendor-overwrites/colorpicker/colorview.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vendor-overwrites/colorpicker/colorview.js b/vendor-overwrites/colorpicker/colorview.js index 84486a02..4892876e 100644 --- a/vendor-overwrites/colorpicker/colorview.js +++ b/vendor-overwrites/colorpicker/colorview.js @@ -358,6 +358,9 @@ let spansZombies = markedSpans && markedSpans.length; const spanGeneration = state.now; + // all comments may get blanked out in the loop + const endsWithComment = text.endsWith('*/'); + for (let i = styleIndex; i + 1 < styles.length; i += 2) { style = styles[i + 1]; const styleSupported = style && (style.includes('atom') || style.includes('keyword')); @@ -390,7 +393,7 @@ removeDeadSpans(); - state.inComment = style && style.includes('comment') && !text.endsWith('*/'); + state.inComment = style && style.includes('comment') && !endsWithComment; state.line++; return;