From b57d93da8a35c552a1f33abdd735c7b08142237a Mon Sep 17 00:00:00 2001 From: Maksym Taran Date: Wed, 5 Jun 2019 18:35:54 -0700 Subject: [PATCH] Add U+FFFC as a default replaced special character --- doc/manual.html | 2 +- src/edit/options.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/manual.html b/doc/manual.html index 28030d5b1e..a0a8806240 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -284,7 +284,7 @@

Configuration

should be replaced by a special placeholder. Mostly useful for non-printing special characters. The default - is /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/. + is /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufffc]/.
specialCharPlaceholder: function(char) → Element
A function that, given a special character identified by the specialChars diff --git a/src/edit/options.js b/src/edit/options.js index ccca45dd3c..9687a36760 100644 --- a/src/edit/options.js +++ b/src/edit/options.js @@ -68,7 +68,7 @@ export function defineOptions(CodeMirror) { for (let i = newBreaks.length - 1; i >= 0; i--) replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)) }) - option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, (cm, val, old) => { + option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufffc]/g, (cm, val, old) => { cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g") if (old != Init) cm.refresh() })