Skip to content

Commit ace744e

Browse files
committed
Merge branch 'master' into joh/progress-api
2 parents cfd71c7 + 588b14b commit ace744e

22 files changed

Lines changed: 246 additions & 102 deletions

File tree

build/gulpfile.vscode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const nodeModules = ['electron', 'original-fs']
4141

4242
const builtInExtensions = [
4343
{ name: 'ms-vscode.node-debug', version: '1.9.8' },
44-
{ name: 'ms-vscode.node-debug2', version: '1.9.4' }
44+
{ name: 'ms-vscode.node-debug2', version: '1.9.5' }
4545
];
4646

4747
const vscodeEntryPoints = _.flatten([

src/vs/code/electron-main/window.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const defaultWindowState = function (mode = WindowMode.Normal): IWindowSt
4747
return {
4848
width: 1024,
4949
height: 768,
50-
mode: mode
50+
mode
5151
};
5252
};
5353

src/vs/code/electron-main/windows.ts

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { IBackupMainService } from 'vs/platform/backup/common/backup';
1717
import { trim } from 'vs/base/common/strings';
1818
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
1919
import { IStorageService } from 'vs/code/electron-main/storage';
20-
import { IPath, VSCodeWindow, IWindowConfiguration, IWindowState as ISingleWindowState, defaultWindowState, ReadyState } from 'vs/code/electron-main/window';
20+
import { IPath, VSCodeWindow, IWindowConfiguration, IWindowState as ISingleWindowState, defaultWindowState, ReadyState, WindowMode } from 'vs/code/electron-main/window';
2121
import { ipcMain as ipc, app, screen, BrowserWindow, dialog } from 'electron';
2222
import { IPathWithLineAndColumn, parseLineAndColumnAware } from 'vs/code/electron-main/paths';
2323
import { ILifecycleService, UnloadReason } from 'vs/code/electron-main/lifecycle';
@@ -767,7 +767,7 @@ export class WindowsManager implements IWindowsMainService {
767767
state: this.getNewWindowState(configuration),
768768
extensionDevelopmentPath: configuration.extensionDevelopmentPath,
769769
isExtensionTestHost: !!configuration.extensionTestsPath,
770-
allowFullscreen: this.lifecycleService.wasUpdated || (windowConfig && windowConfig.restoreFullscreen),
770+
allowFullscreen: this.lifecycleService.wasUpdated || (windowConfig && windowConfig.restoreFullscreen) || (windowConfig && windowConfig.newWindowDimensions && windowConfig.newWindowDimensions === 'fullscreen'),
771771
titleBarStyle: windowConfig ? windowConfig.titleBarStyle : void 0
772772
},
773773
this.logService,
@@ -876,11 +876,31 @@ export class WindowsManager implements IWindowsMainService {
876876
}
877877
}
878878

879-
const defaultState = defaultWindowState();
880-
defaultState.x = displayToUse.bounds.x + (displayToUse.bounds.width / 2) - (defaultState.width / 2);
881-
defaultState.y = displayToUse.bounds.y + (displayToUse.bounds.height / 2) - (defaultState.height / 2);
879+
let state = defaultWindowState();
880+
state.x = displayToUse.bounds.x + (displayToUse.bounds.width / 2) - (state.width / 2);
881+
state.y = displayToUse.bounds.y + (displayToUse.bounds.height / 2) - (state.height / 2);
882882

883-
return this.ensureNoOverlap(defaultState);
883+
// Check for newWindowDimensions setting and adjust accordingly
884+
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
885+
let ensureNoOverlap = true;
886+
if (windowConfig && windowConfig.newWindowDimensions) {
887+
if (windowConfig.newWindowDimensions === 'maximized') {
888+
state.mode = WindowMode.Maximized;
889+
ensureNoOverlap = false;
890+
} else if (windowConfig.newWindowDimensions === 'fullscreen') {
891+
state.mode = WindowMode.Fullscreen;
892+
ensureNoOverlap = false;
893+
} else if (windowConfig.newWindowDimensions === 'inherit' && lastActive) {
894+
state = lastActive.serializeWindowState();
895+
ensureNoOverlap = false;
896+
}
897+
}
898+
899+
if (ensureNoOverlap) {
900+
state = this.ensureNoOverlap(state);
901+
}
902+
903+
return state;
884904
}
885905

886906
private ensureNoOverlap(state: ISingleWindowState): ISingleWindowState {

src/vs/editor/browser/standalone/colorizer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export class Colorizer {
9696

9797
public static colorizeLine(line: string, mightContainRTL: boolean, tokens: ViewLineToken[], tabSize: number = 4): string {
9898
let renderResult = renderViewLine(new RenderLineInput(
99+
false,
99100
line,
100101
mightContainRTL,
101102
0,
@@ -129,6 +130,7 @@ function _fakeColorize(lines: string[], tabSize: number): string {
129130
let line = lines[i];
130131

131132
let renderResult = renderViewLine(new RenderLineInput(
133+
false,
132134
line,
133135
false,
134136
0,
@@ -158,6 +160,7 @@ function _actualColorize(lines: string[], tabSize: number, tokenizationSupport:
158160
let tokenizeResult = tokenizationSupport.tokenize2(line, state, 0);
159161
let lineTokens = new LineTokens(colorMap, tokenizeResult.tokens, line);
160162
let renderResult = renderViewLine(new RenderLineInput(
163+
false,
161164
line,
162165
true/* check for RTL */,
163166
0,

src/vs/editor/browser/viewParts/lines/viewLine.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class ViewLine implements IVisibleLineData {
2222
private _renderWhitespace: 'none' | 'boundary' | 'all';
2323
private _renderControlCharacters: boolean;
2424
private _spaceWidth: number;
25+
private _fontIsMonospace: boolean;
2526
private _lineHeight: number;
2627
private _stopRenderingLineAfter: number;
2728

@@ -34,6 +35,7 @@ export class ViewLine implements IVisibleLineData {
3435
this._renderWhitespace = this._context.configuration.editor.viewInfo.renderWhitespace;
3536
this._renderControlCharacters = this._context.configuration.editor.viewInfo.renderControlCharacters;
3637
this._spaceWidth = this._context.configuration.editor.fontInfo.spaceWidth;
38+
this._fontIsMonospace = this._context.configuration.editor.fontInfo.isMonospace;
3739
this._lineHeight = this._context.configuration.editor.lineHeight;
3840
this._stopRenderingLineAfter = this._context.configuration.editor.viewInfo.stopRenderingLineAfter;
3941

@@ -79,6 +81,7 @@ export class ViewLine implements IVisibleLineData {
7981
if (e.fontInfo) {
8082
this._isMaybeInvalid = true;
8183
this._spaceWidth = this._context.configuration.editor.fontInfo.spaceWidth;
84+
this._fontIsMonospace = this._context.configuration.editor.fontInfo.isMonospace;
8285
}
8386
if (e.lineHeight) {
8487
this._isMaybeInvalid = true;
@@ -101,6 +104,7 @@ export class ViewLine implements IVisibleLineData {
101104
const actualInlineDecorations = Decoration.filter(inlineDecorations, lineNumber, model.getLineMinColumn(lineNumber), model.getLineMaxColumn(lineNumber));
102105

103106
let renderLineInput = new RenderLineInput(
107+
this._fontIsMonospace,
104108
model.getLineContent(lineNumber),
105109
model.mightContainRTL(),
106110
model.getLineMinColumn(lineNumber) - 1,

src/vs/editor/browser/widget/diffEditorWidget.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,6 +1889,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
18891889
let actualDecorations = Decoration.filter(decorations, lineNumber, 1, lineContent.length + 1);
18901890

18911891
let r = renderViewLine(new RenderLineInput(
1892+
config.fontInfo.isMonospace,
18921893
lineContent,
18931894
originalModel.mightContainRTL(),
18941895
0,

src/vs/editor/common/viewLayout/viewLineRenderer.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const enum RenderWhitespace {
1717

1818
export class RenderLineInput {
1919

20+
public readonly fontIsMonospace: boolean;
2021
public readonly lineContent: string;
2122
public readonly mightContainRTL: boolean;
2223
public readonly fauxIndentLength: number;
@@ -29,6 +30,7 @@ export class RenderLineInput {
2930
public readonly renderControlCharacters: boolean;
3031

3132
constructor(
33+
fontIsMonospace: boolean,
3234
lineContent: string,
3335
mightContainRTL: boolean,
3436
fauxIndentLength: number,
@@ -40,6 +42,7 @@ export class RenderLineInput {
4042
renderWhitespace: 'none' | 'boundary' | 'all',
4143
renderControlCharacters: boolean,
4244
) {
45+
this.fontIsMonospace = fontIsMonospace;
4346
this.lineContent = lineContent;
4447
this.mightContainRTL = mightContainRTL;
4548
this.fauxIndentLength = fauxIndentLength;
@@ -60,7 +63,8 @@ export class RenderLineInput {
6063

6164
public equals(other: RenderLineInput): boolean {
6265
return (
63-
this.lineContent === other.lineContent
66+
this.fontIsMonospace === other.fontIsMonospace
67+
&& this.lineContent === other.lineContent
6468
&& this.mightContainRTL === other.mightContainRTL
6569
&& this.fauxIndentLength === other.fauxIndentLength
6670
&& this.tabSize === other.tabSize
@@ -225,6 +229,7 @@ export function renderViewLine(input: RenderLineInput): RenderLineOutput {
225229

226230
class ResolvedRenderLineInput {
227231
constructor(
232+
public readonly fontIsMonospace: boolean,
228233
public readonly lineContent: string,
229234
public readonly len: number,
230235
public readonly isOverflowing: boolean,
@@ -241,6 +246,7 @@ class ResolvedRenderLineInput {
241246
}
242247

243248
function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput {
249+
const fontIsMonospace = input.fontIsMonospace;
244250
const lineContent = input.lineContent;
245251

246252
let isOverflowing: boolean;
@@ -256,7 +262,7 @@ function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput
256262

257263
let tokens = removeOverflowing(input.lineTokens, len);
258264
if (input.renderWhitespace === RenderWhitespace.All || input.renderWhitespace === RenderWhitespace.Boundary) {
259-
tokens = _applyRenderWhitespace(lineContent, len, tokens, input.fauxIndentLength, input.tabSize, input.renderWhitespace === RenderWhitespace.Boundary);
265+
tokens = _applyRenderWhitespace(lineContent, len, tokens, input.fauxIndentLength, input.tabSize, fontIsMonospace, input.renderWhitespace === RenderWhitespace.Boundary);
260266
}
261267
if (input.lineDecorations.length > 0) {
262268
tokens = _applyInlineDecorations(lineContent, len, tokens, input.lineDecorations);
@@ -270,6 +276,7 @@ function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput
270276
}
271277

272278
return new ResolvedRenderLineInput(
279+
fontIsMonospace,
273280
lineContent,
274281
len,
275282
isOverflowing,
@@ -351,7 +358,7 @@ function splitLargeTokens(tokens: ViewLineToken[]): ViewLineToken[] {
351358
* Moreover, a token is created for every visual indent because on some fonts the glyphs used for rendering whitespace (&rarr; or &middot;) do not have the same width as &nbsp;.
352359
* The rendering phase will generate `style="width:..."` for these tokens.
353360
*/
354-
function _applyRenderWhitespace(lineContent: string, len: number, tokens: ViewLineToken[], fauxIndentLength: number, tabSize: number, onlyBoundary: boolean): ViewLineToken[] {
361+
function _applyRenderWhitespace(lineContent: string, len: number, tokens: ViewLineToken[], fauxIndentLength: number, tabSize: number, fontIsMonospace: boolean, onlyBoundary: boolean): ViewLineToken[] {
355362

356363
let result: ViewLineToken[] = [], resultLen = 0;
357364
let tokenIndex = 0;
@@ -413,7 +420,7 @@ function _applyRenderWhitespace(lineContent: string, len: number, tokens: ViewLi
413420

414421
if (wasInWhitespace) {
415422
// was in whitespace token
416-
if (!isInWhitespace || tmpIndent >= tabSize) {
423+
if (!isInWhitespace || (!fontIsMonospace && tmpIndent >= tabSize)) {
417424
// leaving whitespace token or entering a new indent
418425
result[resultLen++] = new ViewLineToken(charIndex, 'vs-whitespace');
419426
tmpIndent = tmpIndent % tabSize;
@@ -499,6 +506,7 @@ function _applyInlineDecorations(lineContent: string, len: number, tokens: ViewL
499506
* Notice how all the needed data is fully resolved and passed in (i.e. no other calls).
500507
*/
501508
function _renderLine(input: ResolvedRenderLineInput): RenderLineOutput {
509+
const fontIsMonospace = input.fontIsMonospace;
502510
const lineContent = input.lineContent;
503511
const len = input.len;
504512
const isOverflowing = input.isOverflowing;
@@ -555,7 +563,11 @@ function _renderLine(input: ResolvedRenderLineInput): RenderLineOutput {
555563
}
556564

557565
characterMapping.setPartLength(tokenIndex, partContentCnt);
558-
out += `<span class="${tokenType}" style="width:${spaceWidth * partContentCnt}px">${partContent}</span>`;
566+
if (fontIsMonospace) {
567+
out += `<span class="${tokenType}">${partContent}</span>`;
568+
} else {
569+
out += `<span class="${tokenType}" style="width:${spaceWidth * partContentCnt}px">${partContent}</span>`;
570+
}
559571

560572
} else {
561573

src/vs/editor/test/common/viewLayout/viewLineParts.test.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ suite('Editor ViewLayout - ViewLineParts', () => {
5555
]);
5656
});
5757

58-
function testCreateLineParts(lineContent: string, tokens: ViewLineToken[], fauxIndentLength: number, renderWhitespace: 'none' | 'boundary' | 'all', expected: string): void {
58+
function testCreateLineParts(fontIsMonospace: boolean, lineContent: string, tokens: ViewLineToken[], fauxIndentLength: number, renderWhitespace: 'none' | 'boundary' | 'all', expected: string): void {
5959
let actual = renderViewLine(new RenderLineInput(
60+
fontIsMonospace,
6061
lineContent,
6162
false,
6263
fauxIndentLength,
@@ -77,6 +78,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
7778
let lineContent = 'https://microsoft.com';
7879

7980
let actual = renderViewLine(new RenderLineInput(
81+
false,
8082
lineContent,
8183
false,
8284
0,
@@ -100,6 +102,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
100102

101103
test('createLineParts simple', () => {
102104
testCreateLineParts(
105+
false,
103106
'Hello world!',
104107
[
105108
new ViewLineToken(12, '')
@@ -115,6 +118,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
115118
});
116119
test('createLineParts simple two tokens', () => {
117120
testCreateLineParts(
121+
false,
118122
'Hello world!',
119123
[
120124
new ViewLineToken(6, 'a'),
@@ -132,6 +136,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
132136
});
133137
test('createLineParts render whitespace - 4 leading spaces', () => {
134138
testCreateLineParts(
139+
false,
135140
' Hello world! ',
136141
[
137142
new ViewLineToken(4, ''),
@@ -152,6 +157,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
152157
});
153158
test('createLineParts render whitespace - 8 leading spaces', () => {
154159
testCreateLineParts(
160+
false,
155161
' Hello world! ',
156162
[
157163
new ViewLineToken(8, ''),
@@ -174,6 +180,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
174180
});
175181
test('createLineParts render whitespace - 2 leading tabs', () => {
176182
testCreateLineParts(
183+
false,
177184
'\t\tHello world!\t',
178185
[
179186
new ViewLineToken(2, ''),
@@ -195,6 +202,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
195202
});
196203
test('createLineParts render whitespace - mixed leading spaces and tabs', () => {
197204
testCreateLineParts(
205+
false,
198206
' \t\t Hello world! \t \t \t ',
199207
[
200208
new ViewLineToken(6, ''),
@@ -221,6 +229,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
221229

222230
test('createLineParts render whitespace skips faux indent', () => {
223231
testCreateLineParts(
232+
false,
224233
'\t\t Hello world! \t \t \t ',
225234
[
226235
new ViewLineToken(4, ''),
@@ -244,8 +253,32 @@ suite('Editor ViewLayout - ViewLineParts', () => {
244253
);
245254
});
246255

256+
test('createLineParts does not emit width for monospace fonts', () => {
257+
testCreateLineParts(
258+
true,
259+
'\t\t Hello world! \t \t \t ',
260+
[
261+
new ViewLineToken(4, ''),
262+
new ViewLineToken(6, 'a'),
263+
new ViewLineToken(29, 'b')
264+
],
265+
2,
266+
'boundary',
267+
[
268+
'<span>',
269+
'<span class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>',
270+
'<span class="vs-whitespace">&middot;&middot;</span>',
271+
'<span class="a">He</span>',
272+
'<span class="b">llo&nbsp;world!</span>',
273+
'<span class="vs-whitespace">&middot;&rarr;&middot;&middot;&rarr;&nbsp;&middot;&middot;&middot;&rarr;&middot;&middot;&middot;&middot;</span>',
274+
'</span>',
275+
].join('')
276+
);
277+
});
278+
247279
test('createLineParts render whitespace in middle but not for one space', () => {
248280
testCreateLineParts(
281+
false,
249282
'it it it it',
250283
[
251284
new ViewLineToken(6, ''),
@@ -270,6 +303,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
270303

271304
test('createLineParts render whitespace for all in middle', () => {
272305
testCreateLineParts(
306+
false,
273307
' Hello world!\t',
274308
[
275309
new ViewLineToken(4, ''),
@@ -293,6 +327,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
293327

294328
test('createLineParts can handle unsorted inline decorations', () => {
295329
let actual = renderViewLine(new RenderLineInput(
330+
false,
296331
'Hello world',
297332
false,
298333
0,
@@ -398,6 +433,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
398433

399434
function createTestGetColumnOfLinePartOffset(lineContent: string, tabSize: number, parts: ViewLineToken[], expectedPartLengths: number[]): (partIndex: number, partLength: number, offset: number, expected: number) => void {
400435
let renderLineOutput = renderViewLine(new RenderLineInput(
436+
false,
401437
lineContent,
402438
false,
403439
0,

0 commit comments

Comments
 (0)