1
0
mirror of https://github.com/salexdv/bsl_console.git synced 2024-11-24 08:33:29 +02:00

Замена символа табуляции

This commit is contained in:
salexdv 2022-08-18 14:10:24 +03:00
parent 19c6aa5fb6
commit 5e65acce10

View File

@ -641,7 +641,7 @@ return e.prototype.sameSelection=function(e){if(null===this.selectionsOnLine)ret
return this.useMonospaceOptimizations===e.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineContent===e.lineContent&&this.continuesWithWrappedLine===e.continuesWithWrappedLine&&this.isBasicASCII===e.isBasicASCII&&this.containsRTL===e.containsRTL&&this.fauxIndentLength===e.fauxIndentLength&&this.tabSize===e.tabSize&&this.startVisibleColumn===e.startVisibleColumn&&this.spaceWidth===e.spaceWidth&&this.stopRenderingLineAfter===e.stopRenderingLineAfter&&this.renderWhitespace===e.renderWhitespace&&this.renderControlCharacters===e.renderControlCharacters&&this.fontLigatures===e.fontLigatures&&o.LineDecoration.equalsArr(this.lineDecorations,e.lineDecorations)&&this.lineTokens.equals(e.lineTokens)&&this.sameSelection(e.selectionsOnLine)},e}();t.RenderLineInput=a;var l=function(){function e(e,t){this.length=e,this._data=new Uint32Array(this.length),this._absoluteOffsets=new Uint32Array(this.length)}return e.getPartIndex=function(e){return(4294901760&e)>>>16},
e.getCharIndex=function(e){return(65535&e)>>>0},e.prototype.setPartData=function(e,t,n,i){var o=(t<<16|n<<0)>>>0;this._data[e]=o,this._absoluteOffsets[e]=i+n},e.prototype.getAbsoluteOffsets=function(){return this._absoluteOffsets},e.prototype.charOffsetToPartData=function(e){return 0===this.length?0:e<0?this._data[0]:e>=this.length?this._data[this.length-1]:this._data[e]},e.prototype.partDataToCharOffset=function(t,n,i){if(0===this.length)return 0;for(var o=(t<<16|i<<0)>>>0,r=0,s=this.length-1;r+1<s;){var a=r+s>>>1,l=this._data[a];if(l===o)return a;l>o?s=a:r=a}if(r===s)return r;var u=this._data[r],d=this._data[s];if(u===o)return r;if(d===o)return s;var c=e.getPartIndex(u);return i-e.getCharIndex(u)<=(c!==e.getPartIndex(d)?n:e.getCharIndex(d))-i?r:s},e}();t.CharacterMapping=l;var u=function(e,t,n){this.characterMapping=e,this.containsRTL=t,this.containsForeignElements=n};function d(e,t){if(0===e.lineContent.length){var i=0,s="<span><span> </span></span>";if(e.lineDecorations.length>0){
for(var a=[],d=[],c=0,p=e.lineDecorations.length;c<p;c++){var g=e.lineDecorations[c];1===g.type&&(a.push(e.lineDecorations[c].className),i|=1),2===g.type&&(d.push(e.lineDecorations[c].className),i|=2)}if(0!==i)s="<span>"+(a.length>0?'<span class="'+a.join(" ")+'"></span>':"")+(d.length>0?'<span class="'+d.join(" ")+'"></span>':"")+"</span>"}return t.appendASCIIString(s),new u(new l(0,0),!1,i)}return function(e,t){var i=e.fontIsMonospace,o=e.canUseHalfwidthRightwardsArrow,r=e.containsForeignElements,s=e.lineContent,a=e.len,d=e.isOverflowing,c=e.parts,h=e.fauxIndentLength,p=e.tabSize,g=e.startVisibleColumn,f=e.containsRTL,m=e.spaceWidth,v=e.middotWidth,_=e.renderWhitespace,y=e.renderControlCharacters,C=v>m?11825:183,b=new l(a+1,c.length),S=0,w=g,E=0,L=0,D=0;t.appendASCIIString("<span>");for(var N=0,x=c.length;N<x;N++){D+=L;var I=c[N],M=I.endIndex,k=I.type,T=0!==_&&k.indexOf("vs-whitespace")>=0;if(E=0,t.appendASCIIString('<span class="'),t.appendASCIIString(k),t.appendASCII(34),T){for(var R=0,O=S,P=w;O<M;O++){
var A=s.charCodeAt(O);R+=F=0|(9===A?p-P%p:1),O>=h&&(P+=F)}if(!i)!("vs-whitespace"===k)&&r||(t.appendASCIIString(' style="display:inline-block;width:'),t.appendASCIIString(String(m*R)),t.appendASCIIString('px"'));for(t.appendASCII(62);S<M;S++){b.setPartData(S,N,E,D);A=s.charCodeAt(S);var F=void 0;if(9===A){F=p-w%p|0,!o||F>1?t.write1(8594):t.write1(65515);for(var W=2;W<=F;W++)t.write1(160)}else F=1,t.write1(C);E+=F,S>=h&&(w+=F)}L=R}else{R=0;for(f&&t.appendASCIIString(' dir="ltr"'),t.appendASCII(62);S<M;S++){b.setPartData(S,N,E,D);A=s.charCodeAt(S);var B=1;F=1;switch(A){case 9:F=B=p-w%p;for(W=1;W<=B;W++)t.write1(160);break;case 32:t.write1(160);break;case 60:t.appendASCIIString("&lt;");break;case 62:t.appendASCIIString("&gt;");break;case 38:t.appendASCIIString("&amp;");break;case 0:t.appendASCIIString("&#00;");break;case 65279:case 8232:t.write1(65533);break;default:n.isFullWidthCharacter(A)&&F++,y&&A<32?t.write1(9216+A):t.write1(A)}E+=B,R+=B,S>=h&&(w+=F)}L=R}t.appendASCIIString("</span>")}
var A=s.charCodeAt(O);R+=F=0|(9===A?p-P%p:1),O>=h&&(P+=F)}if(!i)!("vs-whitespace"===k)&&r||(t.appendASCIIString(' style="display:inline-block;width:'),t.appendASCIIString(String(m*R)),t.appendASCIIString('px"'));for(t.appendASCII(62);S<M;S++){b.setPartData(S,N,E,D);A=s.charCodeAt(S);var F=void 0;if(9===A){F=p-w%p|0,!o||F>1?t.write1(187):t.write1(65515);for(var W=2;W<=F;W++)t.write1(160)}else F=1,t.write1(C);E+=F,S>=h&&(w+=F)}L=R}else{R=0;for(f&&t.appendASCIIString(' dir="ltr"'),t.appendASCII(62);S<M;S++){b.setPartData(S,N,E,D);A=s.charCodeAt(S);var B=1;F=1;switch(A){case 9:F=B=p-w%p;for(W=1;W<=B;W++)t.write1(160);break;case 32:t.write1(160);break;case 60:t.appendASCIIString("&lt;");break;case 62:t.appendASCIIString("&gt;");break;case 38:t.appendASCIIString("&amp;");break;case 0:t.appendASCIIString("&#00;");break;case 65279:case 8232:t.write1(65533);break;default:n.isFullWidthCharacter(A)&&F++,y&&A<32?t.write1(9216+A):t.write1(A)}E+=B,R+=B,S>=h&&(w+=F)}L=R}t.appendASCIIString("</span>")}
b.setPartData(a,c.length-1,E,D),d&&t.appendASCIIString("<span>&hellip;</span>");return t.appendASCIIString("</span>"),new u(b,f,r)}(function(e){var t,i,s=e.useMonospaceOptimizations,a=e.lineContent;-1!==e.stopRenderingLineAfter&&e.stopRenderingLineAfter<a.length?(t=!0,i=e.stopRenderingLineAfter):(t=!1,i=a.length);var l=function(e,t,n){var i=[],o=0;t>0&&(i[o++]=new r(t,""));for(var s=0,a=e.getCount();s<a;s++){var l=e.getEndOffset(s);if(!(l<=t)){var u=e.getClassName(s);if(l>=n){i[o++]=new r(n,u);break}i[o++]=new r(l,u)}}return i}(e.lineTokens,e.fauxIndentLength,i);(3===e.renderWhitespace||1===e.renderWhitespace||2===e.renderWhitespace&&e.selectionsOnLine)&&(l=function(e,t,i,o,s,a,l,u,d,c){var h,p=[],g=0,f=0,m=o[f].type,v=o[f].endIndex,_=o.length,y=n.firstNonWhitespaceIndex(e);-1===y?(y=t,h=t):h=n.lastNonWhitespaceIndex(e);for(var C=!1,b=0,S=d&&d[b],w=l%a,E=s;E<t;E++){var L=e.charCodeAt(E);S&&E>=S.endOffset&&(b++,S=d&&d[b]);var D=void 0;if(E<y||E>h)D=!0;else if(9===L)D=!0;else if(32===L)if(c)if(C)D=!0;else{
var N=E+1<t?e.charCodeAt(E+1):0;D=32===N||9===N}else D=!0;else D=!1;D&&d&&(D=!!S&&S.startOffset<=E&&S.endOffset>E),C?(!D||!u&&w>=a)&&(p[g++]=new r(E,"vs-whitespace"),w%=a):(E===v||D&&E>s)&&(p[g++]=new r(E,m),w%=a),9===L?w=a:n.isFullWidthCharacter(L)?w+=2:w++,C=D,E===v&&++f<_&&(m=o[f].type,v=o[f].endIndex)}var x=!1;if(C)if(i&&c){var I=t>0?e.charCodeAt(t-1):0,M=t>1?e.charCodeAt(t-2):0;32===I&&32!==M&&9!==M||(x=!0)}else x=!0;return p[g++]=new r(t,x?"vs-whitespace":m),p}(a,i,e.continuesWithWrappedLine,l,e.fauxIndentLength,e.tabSize,e.startVisibleColumn,s,e.selectionsOnLine,1===e.renderWhitespace));var u=0;if(e.lineDecorations.length>0){for(var d=0,c=e.lineDecorations.length;d<c;d++){var p=e.lineDecorations[d];3===p.type?u|=1:1===p.type?u|=1:2===p.type&&(u|=2)}l=function(e,t,n,i){i.sort(o.LineDecoration.compare);for(var s=o.LineDecorationsNormalizer.normalize(e,i),a=s.length,l=0,u=[],d=0,c=0,h=0,p=n.length;h<p;h++){for(var g=n[h],f=g.endIndex,m=g.type;l<a&&s[l].startOffset<f;){var v=s[l]
;if(v.startOffset>c&&(c=v.startOffset,u[d++]=new r(c,m)),!(v.endOffset+1<=f)){c=f,u[d++]=new r(c,m+" "+v.className);break}c=v.endOffset+1,u[d++]=new r(c,m+" "+v.className),l++}f>c&&(c=f,u[d++]=new r(c,m))}var _=n[n.length-1].endIndex;if(l<a&&s[l].startOffset===_){for(var y=[];l<a&&s[l].startOffset===_;)y.push(s[l].className),l++;u[d++]=new r(c,y.join(" "))}return u}(a,0,l,e.lineDecorations)}e.containsRTL||(l=function(e,t,n){var i=0,o=[],s=0;if(n)for(var a=0,l=t.length;a<l;a++){var u=(g=t[a]).endIndex;if(i+50<u){for(var d=g.type,c=-1,h=i,p=i;p<u;p++)32===e.charCodeAt(p)&&(c=p),-1!==c&&p-h>=50&&(o[s++]=new r(c+1,d),h=c+1,c=-1);h!==u&&(o[s++]=new r(u,d))}else o[s++]=g;i=u}else for(a=0,l=t.length;a<l;a++){var g=t[a],f=(u=g.endIndex)-i;if(f>50){d=g.type;var m=Math.ceil(f/50);for(p=1;p<m;p++){var v=i+50*p;o[s++]=new r(v,d)}o[s++]=new r(u,d)}else o[s++]=g;i=u}return o}(a,l,!e.isBasicASCII||e.fontLigatures))