Fix: normalizeString -> unquote

This commit is contained in:
eight 2017-11-09 07:13:49 +08:00
parent 3844b3db73
commit 2edd22e37c

View File

@ -388,8 +388,8 @@ function createAppliesToLineWidget(cm) {
const apply = createApply( const apply = createApply(
re.lastIndex + offset, re.lastIndex + offset,
m[1], m[1],
normalizeString(m[2]), unquote(m[2]),
normalizeString(m[2]) !== m[2] unquote(m[2]) !== m[2]
); );
applies.push(apply); applies.push(apply);
t = t.slice(m[0].length); t = t.slice(m[0].length);
@ -401,10 +401,8 @@ function createAppliesToLineWidget(cm) {
} }
} }
function normalizeString(s) { function unquote(s) {
if (/^(['"])[\s\S]*\1$/.test(s)) { const first = s.charAt(0);
return s.slice(1, -1); return (first === '"' || first === "'") && s.endsWith(first) ? s.slice(1, -1) : s;
}
return s;
} }
} }