Made kalk_web symbol completion code cleaner

This commit is contained in:
PaddiM8 2021-01-02 18:37:35 +01:00
parent 536c6962d6
commit 4c3af6556e

View File

@ -86,39 +86,36 @@
/(?<identifier>[^!-@\s_|^⌊⌋⌈⌉]+(_\d+)?)|(?<op>[+\-/*%^!])/g, /(?<identifier>[^!-@\s_|^⌊⌋⌈⌉]+(_\d+)?)|(?<op>[+\-/*%^!])/g,
(substring, identifier, _, op) => { (substring, identifier, _, op) => {
if (identifier) { if (identifier) {
let newSubstring: string;
switch (substring) { switch (substring) {
case "sqrt": { case "sqrt": {
substring = "√"; newSubstring = "√";
offset += 3;
break; break;
} }
case "sum": { case "sum": {
substring = "Σ"; newSubstring = "Σ";
offset += 2;
break; break;
} }
case "pi": { case "pi": {
substring = "π"; newSubstring = "π";
offset += 1;
break; break;
} }
case "gamma": { case "gamma": {
substring = "Γ"; newSubstring = "Γ";
offset += 4;
break; break;
} }
case "floor": { case "floor": {
substring = "⌊⌋"; newSubstring = "⌊⌋";
offset += 3;
break; break;
} }
case "ceil": { case "ceil": {
substring = "⌈⌉"; newSubstring = "⌈⌉";
offset += 3;
break; break;
} }
} }
offset += substring.length - newSubstring.length;
return `<span class="identifier">${substring}</span>`; return `<span class="identifier">${substring}</span>`;
} }