32
33
export function tokenizeLineToHTML(text: string, viewLineTokens: IViewLineTokens, colorMap: string[], startOffset: number, endOffset: number, tabSize: number, useNbsp: boolean): string {
35
>
let charIndex = 0;
36
>
let width = 0;
37
>
38
>
let prevIsSpace = true;
39
>
40
>
for (let tokenIndex = 0, tokenCount = viewLineTokens.getCount(); tokenIndex < tokenCount; tokenIndex++) {
41
>
const tokenEndIndex = viewLineTokens.getEndOffset(tokenIndex);
42
>
let partContent = '';
43
>
44
>
for (; charIndex < tokenEndIndex && charIndex < endOffset; charIndex++) {
45
>
const charCode = text.charCodeAt(charIndex);
46
>
const isTab = charCode === CharCode.Tab;
47
>
48
>
width += strings.isFullWidthCharacter(charCode) ? 2 : (isTab ? 0 : 1);
49
>
50
>
if (charIndex < startOffset) {
51
if (isTab) {
52
const remainder = width % tabSize;