Skip to content

Commit 7c6a02c

Browse files
committed
Merge branch 'master' into electron-6.0.x
2 parents 33fdd55 + 5701770 commit 7c6a02c

File tree

72 files changed

+570
-604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+570
-604
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"vscode-ripgrep": "^1.3.1",
5353
"vscode-sqlite3": "4.0.8",
5454
"vscode-textmate": "microsoft/vscode-textmate#update_oniguruma",
55-
"xterm": "3.15.0-beta70",
55+
"xterm": "3.15.0-beta71",
5656
"xterm-addon-search": "0.2.0-beta2",
5757
"xterm-addon-web-links": "0.1.0-beta10",
5858
"yauzl": "^2.9.2",

remote/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"vscode-proxy-agent": "0.4.0",
2222
"vscode-ripgrep": "^1.3.1",
2323
"vscode-textmate": "microsoft/vscode-textmate#update_oniguruma",
24-
"xterm": "3.15.0-beta70",
24+
"xterm": "3.15.0-beta71",
2525
"xterm-addon-search": "0.2.0-beta2",
2626
"xterm-addon-web-links": "0.1.0-beta10",
2727
"yauzl": "^2.9.2",

remote/yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1553,10 +1553,10 @@ [email protected]:
15531553
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.1.0-beta10.tgz#610fa9773a2a5ccd41c1c83ba0e2dd2c9eb66a23"
15541554
integrity sha512-xfpjy0V6bB4BR44qIgZQPoCMVakxb65gMscPkHpO//QxvUxKzabV3dxOsIbeZRFkUGsWTFlvz2OoaBLoNtv5gg==
15551555

1556-
1557-
version "3.15.0-beta70"
1558-
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta70.tgz#3e81f32e8cd7147f9a0764fbe2599c277c697a74"
1559-
integrity sha512-VXhEbWwaxrs9Ac2KuTCmGX7Ktd0V+rVF5sdjXBsq/KBCtnUdwNzKnEjamNPsoNTDUv9y93INEbq82X7iBs1Gwg==
1556+
1557+
version "3.15.0-beta71"
1558+
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta71.tgz#2728c9800ca3b08423e835e9504bd1f4b5de6253"
1559+
integrity sha512-8M/cLaxZ+iDopRxLPdPfKuDGaNNyYTdCeytdxjMSH0N7dZzbx6fbaEygQdCrV5pO9cGnT92MefSjVPGRXRiBLA==
15601560

15611561
yauzl@^2.9.2:
15621562
version "2.10.0"

src/vs/base/browser/ui/grid/grid.ts

+11-25
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'vs/css!./gridview';
77
import { Orientation } from 'vs/base/browser/ui/sash/sash';
88
import { Disposable } from 'vs/base/common/lifecycle';
99
import { tail2 as tail, equals } from 'vs/base/common/arrays';
10-
import { orthogonal, IView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles } from './gridview';
10+
import { orthogonal, IView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize } from './gridview';
1111
import { Event, Emitter } from 'vs/base/common/event';
1212
import { $ } from 'vs/base/browser/dom';
1313
import { LayoutPriority } from 'vs/base/browser/ui/splitview/splitview';
@@ -117,10 +117,6 @@ function getDirectionOrientation(direction: Direction): Orientation {
117117
return direction === Direction.Up || direction === Direction.Down ? Orientation.VERTICAL : Orientation.HORIZONTAL;
118118
}
119119

120-
function getSize(dimensions: { width: number; height: number; }, orientation: Orientation) {
121-
return orientation === Orientation.HORIZONTAL ? dimensions.width : dimensions.height;
122-
}
123-
124120
export function getRelativeLocation(rootOrientation: Orientation, location: number[], direction: Direction): number[] {
125121
const orientation = getLocationOrientation(rootOrientation, location);
126122
const directionOrientation = getDirectionOrientation(direction);
@@ -209,8 +205,6 @@ export class Grid<T extends IView> extends Disposable {
209205

210206
get element(): HTMLElement { return this.gridview.element; }
211207

212-
sashResetSizing: Sizing = Sizing.Distribute;
213-
214208
constructor(view: T, options: IGridOptions = {}) {
215209
super();
216210
this.gridview = new GridView(options);
@@ -298,15 +292,14 @@ export class Grid<T extends IView> extends Disposable {
298292
return this.gridview.swapViews(fromLocation, toLocation);
299293
}
300294

301-
resizeView(view: T, size: number): void {
295+
resizeView(view: T, size: IViewSize): void {
302296
const location = this.getViewLocation(view);
303297
return this.gridview.resizeView(location, size);
304298
}
305299

306-
getViewSize(view: T): number {
300+
getViewSize(view: T): IViewSize {
307301
const location = this.getViewLocation(view);
308-
const viewSize = this.gridview.getViewSize(location);
309-
return getLocationOrientation(this.orientation, location) === Orientation.HORIZONTAL ? viewSize.width : viewSize.height;
302+
return this.gridview.getViewSize(location);
310303
}
311304

312305
// TODO@joao cleanup
@@ -361,18 +354,8 @@ export class Grid<T extends IView> extends Disposable {
361354
}
362355

363356
private doResetViewSize(location: number[]): void {
364-
if (this.sashResetSizing === Sizing.Split) {
365-
const orientation = getLocationOrientation(this.orientation, location);
366-
const firstViewSize = getSize(this.gridview.getViewSize(location), orientation);
367-
const [parentLocation, index] = tail(location);
368-
const secondViewSize = getSize(this.gridview.getViewSize([...parentLocation, index + 1]), orientation);
369-
const totalSize = firstViewSize + secondViewSize;
370-
this.gridview.resizeView(location, Math.floor(totalSize / 2));
371-
372-
} else {
373-
const [parentLocation,] = tail(location);
374-
this.gridview.distributeViewSizes(parentLocation);
375-
}
357+
const [parentLocation,] = tail(location);
358+
this.gridview.distributeViewSizes(parentLocation);
376359
}
377360
}
378361

@@ -563,8 +546,11 @@ export class SerializableGrid<T extends ISerializableView> extends Grid<T> {
563546
const childLocation = [...location, i];
564547

565548
if (i < node.children.length - 1) {
566-
const size = orientation === Orientation.VERTICAL ? child.box.height : child.box.width;
567-
this.gridview.resizeView(childLocation, Math.floor(size * scale));
549+
const size = orientation === Orientation.VERTICAL
550+
? { height: Math.floor(child.box.height * scale) }
551+
: { width: Math.floor(child.box.width * scale) };
552+
553+
this.gridview.resizeView(childLocation, size);
568554
}
569555

570556
this.restoreViewsSize(childLocation, child, orthogonal(orientation), widthScale, heightScale);

src/vs/base/browser/ui/grid/gridview.ts

+26-6
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ import { Color } from 'vs/base/common/color';
1515
export { Sizing, LayoutPriority } from 'vs/base/browser/ui/splitview/splitview';
1616
export { Orientation } from 'vs/base/browser/ui/sash/sash';
1717

18+
export interface IViewSize {
19+
readonly width: number;
20+
readonly height: number;
21+
}
22+
1823
export interface IView {
1924
readonly element: HTMLElement;
2025
readonly minimumWidth: number;
2126
readonly maximumWidth: number;
2227
readonly minimumHeight: number;
2328
readonly maximumHeight: number;
24-
readonly onDidChange: Event<{ width: number; height: number; } | undefined>;
29+
readonly onDidChange: Event<IViewSize | undefined>;
2530
readonly priority?: LayoutPriority;
2631
readonly snapSize?: number;
2732
layout(width: number, height: number, orientation: Orientation): void;
@@ -573,7 +578,7 @@ export class GridView implements IDisposable {
573578
get maximumWidth(): number { return this.root.maximumHeight; }
574579
get maximumHeight(): number { return this.root.maximumHeight; }
575580

576-
private _onDidChange = new Relay<{ width: number; height: number; } | undefined>();
581+
private _onDidChange = new Relay<IViewSize | undefined>();
577582
readonly onDidChange = this._onDidChange.event;
578583

579584
constructor(options: IGridViewOptions = {}) {
@@ -747,18 +752,33 @@ export class GridView implements IDisposable {
747752
}
748753
}
749754

750-
resizeView(location: number[], size: number): void {
755+
resizeView(location: number[], { width, height }: Partial<IViewSize>): void {
751756
const [rest, index] = tail(location);
752-
const [, parent] = this.getNode(rest);
757+
const [pathToParent, parent] = this.getNode(rest);
753758

754759
if (!(parent instanceof BranchNode)) {
755760
throw new Error('Invalid location');
756761
}
757762

758-
parent.resizeChild(index, size);
763+
if (!width && !height) {
764+
return;
765+
}
766+
767+
const [parentSize, grandParentSize] = parent.orientation === Orientation.HORIZONTAL ? [width, height] : [height, width];
768+
769+
if (typeof grandParentSize === 'number' && pathToParent.length > 0) {
770+
const [, grandParent] = tail(pathToParent);
771+
const [, parentIndex] = tail(rest);
772+
773+
grandParent.resizeChild(parentIndex, grandParentSize);
774+
}
775+
776+
if (typeof parentSize === 'number') {
777+
parent.resizeChild(index, parentSize);
778+
}
759779
}
760780

761-
getViewSize(location: number[]): { width: number; height: number; } {
781+
getViewSize(location: number[]): IViewSize {
762782
const [, node] = this.getNode(location);
763783
return { width: node.width, height: node.height };
764784
}

src/vs/base/common/buffer.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -164,23 +164,27 @@ export interface ReadableStream<T> {
164164
/**
165165
* Stops emitting any events until resume() is called.
166166
*/
167-
pause(): void;
167+
pause?(): void;
168168

169169
/**
170170
* Starts emitting events again after pause() was called.
171171
*/
172-
resume(): void;
172+
resume?(): void;
173173

174174
/**
175175
* Destroys the stream and stops emitting any event.
176176
*/
177-
destroy(): void;
177+
destroy?(): void;
178178
}
179179

180180
/**
181181
* A readable stream that sends data via VSBuffer.
182182
*/
183-
export interface VSBufferReadableStream extends ReadableStream<VSBuffer> { }
183+
export interface VSBufferReadableStream extends ReadableStream<VSBuffer> {
184+
pause(): void;
185+
resume(): void;
186+
destroy(): void;
187+
}
184188

185189
export function isVSBufferReadableStream(obj: any): obj is VSBufferReadableStream {
186190
const candidate: VSBufferReadableStream = obj;
@@ -248,10 +252,10 @@ export function bufferToStream(buffer: VSBuffer): VSBufferReadableStream {
248252
/**
249253
* Helper to create a VSBufferStream from a Uint8Array stream.
250254
*/
251-
export function toVSBufferReadableStream(stream: ReadableStream<Uint8Array>): VSBufferReadableStream {
255+
export function toVSBufferReadableStream(stream: ReadableStream<Uint8Array | string>): VSBufferReadableStream {
252256
const vsbufferStream = writeableBufferStream();
253257

254-
stream.on('data', data => vsbufferStream.write(VSBuffer.wrap(data)));
258+
stream.on('data', data => vsbufferStream.write(typeof data === 'string' ? VSBuffer.fromString(data) : VSBuffer.wrap(data)));
255259
stream.on('end', () => vsbufferStream.end());
256260
stream.on('error', error => vsbufferStream.error(error));
257261

0 commit comments

Comments
 (0)