mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 18:22:34 -05:00
Merge from vscode 3c6f6af7347d38e87bc6406024e8dcf9e9bce229 (#8962)
* Merge from vscode 3c6f6af7347d38e87bc6406024e8dcf9e9bce229 * skip failing tests * update mac build image
This commit is contained in:
committed by
Karl Burtram
parent
0eaee18dc4
commit
fefe1454de
@@ -6,7 +6,7 @@
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { ConfigurationChangedEvent, EDITOR_FONT_DEFAULTS, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { ConfigurationChangedEvent, EDITOR_FONT_DEFAULTS, EditorOption, filterValidationDecorations } from 'vs/editor/common/config/editorOptions';
|
||||
import { IPosition, Position } from 'vs/editor/common/core/position';
|
||||
import { IRange, Range } from 'vs/editor/common/core/range';
|
||||
import { IConfiguration, IViewState } from 'vs/editor/common/editorCommon';
|
||||
@@ -596,7 +596,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
|
||||
}
|
||||
|
||||
public getAllOverviewRulerDecorations(theme: ITheme): IOverviewRulerDecorations {
|
||||
return this.lines.getAllOverviewRulerDecorations(this.editorId, this.configuration.options.get(EditorOption.readOnly), theme);
|
||||
return this.lines.getAllOverviewRulerDecorations(this.editorId, filterValidationDecorations(this.configuration.options), theme);
|
||||
}
|
||||
|
||||
public invalidateOverviewRulerColorCache(): void {
|
||||
@@ -656,15 +656,15 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
|
||||
return this.model.getEOL();
|
||||
}
|
||||
|
||||
public getPlainTextToCopy(ranges: Range[], emptySelectionClipboard: boolean, forceCRLF: boolean): string | string[] {
|
||||
public getPlainTextToCopy(modelRanges: Range[], emptySelectionClipboard: boolean, forceCRLF: boolean): string | string[] {
|
||||
const newLineCharacter = forceCRLF ? '\r\n' : this.model.getEOL();
|
||||
|
||||
ranges = ranges.slice(0);
|
||||
ranges.sort(Range.compareRangesUsingStarts);
|
||||
modelRanges = modelRanges.slice(0);
|
||||
modelRanges.sort(Range.compareRangesUsingStarts);
|
||||
|
||||
let hasEmptyRange = false;
|
||||
let hasNonEmptyRange = false;
|
||||
for (const range of ranges) {
|
||||
for (const range of modelRanges) {
|
||||
if (range.isEmpty()) {
|
||||
hasEmptyRange = true;
|
||||
} else {
|
||||
@@ -678,10 +678,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
|
||||
return '';
|
||||
}
|
||||
|
||||
const modelLineNumbers = ranges.map((r) => {
|
||||
const viewLineStart = new Position(r.startLineNumber, 1);
|
||||
return this.coordinatesConverter.convertViewPositionToModelPosition(viewLineStart).lineNumber;
|
||||
});
|
||||
const modelLineNumbers = modelRanges.map((r) => r.startLineNumber);
|
||||
|
||||
let result = '';
|
||||
for (let i = 0; i < modelLineNumbers.length; i++) {
|
||||
@@ -697,14 +694,14 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
|
||||
// mixed empty selections and non-empty selections
|
||||
let result: string[] = [];
|
||||
let prevModelLineNumber = 0;
|
||||
for (const range of ranges) {
|
||||
const modelLineNumber = this.coordinatesConverter.convertViewPositionToModelPosition(new Position(range.startLineNumber, 1)).lineNumber;
|
||||
if (range.isEmpty()) {
|
||||
for (const modelRange of modelRanges) {
|
||||
const modelLineNumber = modelRange.startLineNumber;
|
||||
if (modelRange.isEmpty()) {
|
||||
if (modelLineNumber !== prevModelLineNumber) {
|
||||
result.push(this.model.getLineContent(modelLineNumber));
|
||||
}
|
||||
} else {
|
||||
result.push(this.getValueInRange(range, forceCRLF ? EndOfLinePreference.CRLF : EndOfLinePreference.TextDefined));
|
||||
result.push(this.model.getValueInRange(modelRange, forceCRLF ? EndOfLinePreference.CRLF : EndOfLinePreference.TextDefined));
|
||||
}
|
||||
prevModelLineNumber = modelLineNumber;
|
||||
}
|
||||
@@ -712,31 +709,32 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
|
||||
}
|
||||
|
||||
let result: string[] = [];
|
||||
for (const range of ranges) {
|
||||
if (!range.isEmpty()) {
|
||||
result.push(this.getValueInRange(range, forceCRLF ? EndOfLinePreference.CRLF : EndOfLinePreference.TextDefined));
|
||||
for (const modelRange of modelRanges) {
|
||||
if (!modelRange.isEmpty()) {
|
||||
result.push(this.model.getValueInRange(modelRange, forceCRLF ? EndOfLinePreference.CRLF : EndOfLinePreference.TextDefined));
|
||||
}
|
||||
}
|
||||
return result.length === 1 ? result[0] : result;
|
||||
}
|
||||
|
||||
public getHTMLToCopy(viewRanges: Range[], emptySelectionClipboard: boolean): string | null {
|
||||
if (this.model.getLanguageIdentifier().id === LanguageId.PlainText) {
|
||||
public getRichTextToCopy(modelRanges: Range[], emptySelectionClipboard: boolean): { html: string, mode: string } | null {
|
||||
const languageId = this.model.getLanguageIdentifier();
|
||||
if (languageId.id === LanguageId.PlainText) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (viewRanges.length !== 1) {
|
||||
if (modelRanges.length !== 1) {
|
||||
// no multiple selection support at this time
|
||||
return null;
|
||||
}
|
||||
|
||||
let range = this.coordinatesConverter.convertViewRangeToModelRange(viewRanges[0]);
|
||||
let range = modelRanges[0];
|
||||
if (range.isEmpty()) {
|
||||
if (!emptySelectionClipboard) {
|
||||
// nothing to copy
|
||||
return null;
|
||||
}
|
||||
let lineNumber = range.startLineNumber;
|
||||
const lineNumber = range.startLineNumber;
|
||||
range = new Range(lineNumber, this.model.getLineMinColumn(lineNumber), lineNumber, this.model.getLineMaxColumn(lineNumber));
|
||||
}
|
||||
|
||||
@@ -744,19 +742,22 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
|
||||
const colorMap = this._getColorMap();
|
||||
const fontFamily = fontInfo.fontFamily === EDITOR_FONT_DEFAULTS.fontFamily ? fontInfo.fontFamily : `'${fontInfo.fontFamily}', ${EDITOR_FONT_DEFAULTS.fontFamily}`;
|
||||
|
||||
return (
|
||||
`<div style="`
|
||||
+ `color: ${colorMap[ColorId.DefaultForeground]};`
|
||||
+ `background-color: ${colorMap[ColorId.DefaultBackground]};`
|
||||
+ `font-family: ${fontFamily};`
|
||||
+ `font-weight: ${fontInfo.fontWeight};`
|
||||
+ `font-size: ${fontInfo.fontSize}px;`
|
||||
+ `line-height: ${fontInfo.lineHeight}px;`
|
||||
+ `white-space: pre;`
|
||||
+ `">`
|
||||
+ this._getHTMLToCopy(range, colorMap)
|
||||
+ '</div>'
|
||||
);
|
||||
return {
|
||||
mode: languageId.language,
|
||||
html: (
|
||||
`<div style="`
|
||||
+ `color: ${colorMap[ColorId.DefaultForeground]};`
|
||||
+ `background-color: ${colorMap[ColorId.DefaultBackground]};`
|
||||
+ `font-family: ${fontFamily};`
|
||||
+ `font-weight: ${fontInfo.fontWeight};`
|
||||
+ `font-size: ${fontInfo.fontSize}px;`
|
||||
+ `line-height: ${fontInfo.lineHeight}px;`
|
||||
+ `white-space: pre;`
|
||||
+ `">`
|
||||
+ this._getHTMLToCopy(range, colorMap)
|
||||
+ '</div>'
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
private _getHTMLToCopy(modelRange: Range, colorMap: string[]): string {
|
||||
|
||||
Reference in New Issue
Block a user