111 lines
4.1 KiB
JavaScript
111 lines
4.1 KiB
JavaScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
import * as strings from '../../base/common/strings.js';
|
|
import { Range } from './core/range.js';
|
|
export class Viewport {
|
|
constructor(top, left, width, height) {
|
|
this._viewportBrand = undefined;
|
|
this.top = top | 0;
|
|
this.left = left | 0;
|
|
this.width = width | 0;
|
|
this.height = height | 0;
|
|
}
|
|
}
|
|
export class MinimapLinesRenderingData {
|
|
constructor(tabSize, data) {
|
|
this.tabSize = tabSize;
|
|
this.data = data;
|
|
}
|
|
}
|
|
export class ViewLineData {
|
|
constructor(content, continuesWithWrappedLine, minColumn, maxColumn, startVisibleColumn, tokens, inlineDecorations) {
|
|
this._viewLineDataBrand = undefined;
|
|
this.content = content;
|
|
this.continuesWithWrappedLine = continuesWithWrappedLine;
|
|
this.minColumn = minColumn;
|
|
this.maxColumn = maxColumn;
|
|
this.startVisibleColumn = startVisibleColumn;
|
|
this.tokens = tokens;
|
|
this.inlineDecorations = inlineDecorations;
|
|
}
|
|
}
|
|
export class ViewLineRenderingData {
|
|
constructor(minColumn, maxColumn, content, continuesWithWrappedLine, mightContainRTL, mightContainNonBasicASCII, tokens, inlineDecorations, tabSize, startVisibleColumn) {
|
|
this.minColumn = minColumn;
|
|
this.maxColumn = maxColumn;
|
|
this.content = content;
|
|
this.continuesWithWrappedLine = continuesWithWrappedLine;
|
|
this.isBasicASCII = ViewLineRenderingData.isBasicASCII(content, mightContainNonBasicASCII);
|
|
this.containsRTL = ViewLineRenderingData.containsRTL(content, this.isBasicASCII, mightContainRTL);
|
|
this.tokens = tokens;
|
|
this.inlineDecorations = inlineDecorations;
|
|
this.tabSize = tabSize;
|
|
this.startVisibleColumn = startVisibleColumn;
|
|
}
|
|
static isBasicASCII(lineContent, mightContainNonBasicASCII) {
|
|
if (mightContainNonBasicASCII) {
|
|
return strings.isBasicASCII(lineContent);
|
|
}
|
|
return true;
|
|
}
|
|
static containsRTL(lineContent, isBasicASCII, mightContainRTL) {
|
|
if (!isBasicASCII && mightContainRTL) {
|
|
return strings.containsRTL(lineContent);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
export class InlineDecoration {
|
|
constructor(range, inlineClassName, type) {
|
|
this.range = range;
|
|
this.inlineClassName = inlineClassName;
|
|
this.type = type;
|
|
}
|
|
}
|
|
export class SingleLineInlineDecoration {
|
|
constructor(startOffset, endOffset, inlineClassName, inlineClassNameAffectsLetterSpacing) {
|
|
this.startOffset = startOffset;
|
|
this.endOffset = endOffset;
|
|
this.inlineClassName = inlineClassName;
|
|
this.inlineClassNameAffectsLetterSpacing = inlineClassNameAffectsLetterSpacing;
|
|
}
|
|
toInlineDecoration(lineNumber) {
|
|
return new InlineDecoration(new Range(lineNumber, this.startOffset + 1, lineNumber, this.endOffset + 1), this.inlineClassName, this.inlineClassNameAffectsLetterSpacing ? 3 /* InlineDecorationType.RegularAffectingLetterSpacing */ : 0 /* InlineDecorationType.Regular */);
|
|
}
|
|
}
|
|
export class ViewModelDecoration {
|
|
constructor(range, options) {
|
|
this._viewModelDecorationBrand = undefined;
|
|
this.range = range;
|
|
this.options = options;
|
|
}
|
|
}
|
|
export class OverviewRulerDecorationsGroup {
|
|
constructor(color, zIndex,
|
|
/**
|
|
* Decorations are encoded in a number array using the following scheme:
|
|
* - 3*i = lane
|
|
* - 3*i+1 = startLineNumber
|
|
* - 3*i+2 = endLineNumber
|
|
*/
|
|
data) {
|
|
this.color = color;
|
|
this.zIndex = zIndex;
|
|
this.data = data;
|
|
}
|
|
static cmp(a, b) {
|
|
if (a.zIndex === b.zIndex) {
|
|
if (a.color < b.color) {
|
|
return -1;
|
|
}
|
|
if (a.color > b.color) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
return a.zIndex - b.zIndex;
|
|
}
|
|
}
|