mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 16:50:30 -04:00
Merge from vscode bd0efff9e3f36d6b3e1045cee9887003af8034d7
This commit is contained in:
@@ -233,13 +233,13 @@ export class CommandTrackerAddon implements ICommandTracker, ITerminalAddon {
|
||||
}
|
||||
|
||||
if (this._currentMarker === Boundary.Bottom) {
|
||||
this._currentMarker = xterm.registerMarker(this._getOffset(xterm) - 1);
|
||||
this._currentMarker = this._addMarkerOrThrow(xterm, this._getOffset(xterm) - 1);
|
||||
} else {
|
||||
const offset = this._getOffset(xterm);
|
||||
if (this._isDisposable) {
|
||||
this._currentMarker.dispose();
|
||||
}
|
||||
this._currentMarker = xterm.registerMarker(offset - 1);
|
||||
this._currentMarker = this._addMarkerOrThrow(xterm, offset - 1);
|
||||
}
|
||||
this._isDisposable = true;
|
||||
this._scrollToMarker(this._currentMarker, scrollPosition);
|
||||
@@ -256,18 +256,26 @@ export class CommandTrackerAddon implements ICommandTracker, ITerminalAddon {
|
||||
}
|
||||
|
||||
if (this._currentMarker === Boundary.Top) {
|
||||
this._currentMarker = xterm.registerMarker(this._getOffset(xterm) + 1);
|
||||
this._currentMarker = this._addMarkerOrThrow(xterm, this._getOffset(xterm) + 1);
|
||||
} else {
|
||||
const offset = this._getOffset(xterm);
|
||||
if (this._isDisposable) {
|
||||
this._currentMarker.dispose();
|
||||
}
|
||||
this._currentMarker = xterm.registerMarker(offset + 1);
|
||||
this._currentMarker = this._addMarkerOrThrow(xterm, offset + 1);
|
||||
}
|
||||
this._isDisposable = true;
|
||||
this._scrollToMarker(this._currentMarker, scrollPosition);
|
||||
}
|
||||
|
||||
private _addMarkerOrThrow(xterm: Terminal, cursorYOffset: number): IMarker {
|
||||
const marker = xterm.addMarker(cursorYOffset);
|
||||
if (!marker) {
|
||||
throw new Error(`Could not create marker for ${cursorYOffset}`);
|
||||
}
|
||||
return marker;
|
||||
}
|
||||
|
||||
private _getOffset(xterm: Terminal): number {
|
||||
if (this._currentMarker === Boundary.Bottom) {
|
||||
return 0;
|
||||
|
||||
@@ -11,6 +11,7 @@ import { convertBufferRangeToViewport } from 'vs/workbench/contrib/terminal/brow
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { localize } from 'vs/nls';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
|
||||
export const OPEN_FILE_LABEL = localize('openFile', 'Open file in editor');
|
||||
export const FOLDER_IN_WORKSPACE_LABEL = localize('focusFolder', 'Focus folder in explorer');
|
||||
@@ -19,6 +20,9 @@ export const FOLDER_NOT_IN_WORKSPACE_LABEL = localize('openFolder', 'Open folder
|
||||
export class TerminalLink extends DisposableStore implements ILink {
|
||||
decorations: ILinkDecorations;
|
||||
|
||||
private readonly _onLeave = new Emitter<void>();
|
||||
public get onLeave(): Event<void> { return this._onLeave.event; }
|
||||
|
||||
constructor(
|
||||
public readonly range: IBufferRange,
|
||||
public readonly text: string,
|
||||
@@ -85,6 +89,7 @@ export class TerminalLink extends DisposableStore implements ILink {
|
||||
}
|
||||
|
||||
leave(): void {
|
||||
this._onLeave.fire();
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
|
||||
@@ -186,17 +186,21 @@ export class TerminalLinkManager extends DisposableStore {
|
||||
terminalDimensions,
|
||||
modifierDownCallback,
|
||||
modifierUpCallback
|
||||
}, this._getLinkHoverString(link.text, link.label), (text) => link.activate(undefined, text));
|
||||
}, this._getLinkHoverString(link.text, link.label), (text) => link.activate(undefined, text), link);
|
||||
}
|
||||
|
||||
private _showHover(
|
||||
targetOptions: ILinkHoverTargetOptions,
|
||||
text: IMarkdownString,
|
||||
linkHandler: (url: string) => void
|
||||
linkHandler: (url: string) => void,
|
||||
link?: TerminalLink
|
||||
) {
|
||||
if (this._widgetManager) {
|
||||
const widget = this._instantiationService.createInstance(TerminalHover, targetOptions, text, linkHandler);
|
||||
this._widgetManager.attachWidget(widget);
|
||||
const attached = this._widgetManager.attachWidget(widget);
|
||||
if (attached) {
|
||||
link?.onLeave(() => attached.dispose());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ export class TerminalViewPane extends ViewPane {
|
||||
private _terminalContainer: HTMLElement | undefined;
|
||||
private _findWidget: TerminalFindWidget | undefined;
|
||||
private _splitTerminalAction: IAction | undefined;
|
||||
private _bodyDimensions: { width: number, height: number } = { width: 0, height: 0 };
|
||||
|
||||
constructor(
|
||||
options: IViewPaneOptions,
|
||||
@@ -106,6 +107,8 @@ export class TerminalViewPane extends ViewPane {
|
||||
this._updateTheme();
|
||||
if (hadTerminals) {
|
||||
this._terminalService.getActiveTab()?.setVisible(visible);
|
||||
} else {
|
||||
this.layoutBody(this._bodyDimensions.height, this._bodyDimensions.width);
|
||||
}
|
||||
}
|
||||
}));
|
||||
@@ -116,6 +119,8 @@ export class TerminalViewPane extends ViewPane {
|
||||
|
||||
protected layoutBody(height: number, width: number): void {
|
||||
super.layoutBody(height, width);
|
||||
this._bodyDimensions.width = width;
|
||||
this._bodyDimensions.height = height;
|
||||
this._terminalService.terminalTabs.forEach(t => t.layout(width, height));
|
||||
// Update orientation of split button icon
|
||||
if (this._splitTerminalAction) {
|
||||
|
||||
@@ -93,7 +93,7 @@ export class HoverWidget extends Widget {
|
||||
const actionsElement = $('div.actions');
|
||||
this._actions.forEach(action => this._renderAction(actionsElement, action));
|
||||
statusBarElement.appendChild(actionsElement);
|
||||
this._domNode.appendChild(statusBarElement);
|
||||
this._containerDomNode.appendChild(statusBarElement);
|
||||
}
|
||||
|
||||
this._mouseTracker = new CompositeMouseTracker([this._containerDomNode, ..._target.targetElements]);
|
||||
|
||||
Reference in New Issue
Block a user