提交 215fa337 编写于 作者: D Daniel Imms

Support command tracking from current scroll position

Fixes #46729
上级 de010f53
......@@ -64,7 +64,18 @@ export class CommandTrackerAddon implements ICommandTracker, ITerminalAddon {
}
let markerIndex;
if (this._currentMarker === Boundary.Bottom) {
const currentLineY = Math.min(this._getLine(this._terminal, this._currentMarker), this._terminal.buffer.baseY);
const viewportY = this._terminal.buffer.viewportY;
if (!retainSelection && currentLineY !== viewportY) {
// The user has scrolled, find the line based on the current scroll position. This only
// works when not retaining selection
const markersBelowViewport = this._terminal.markers.filter(e => e.line >= viewportY).length;
if (markersBelowViewport === 0) {
markerIndex = -1;
} else {
markerIndex = this._terminal.markers.length - markersBelowViewport - 1;
}
} else if (this._currentMarker === Boundary.Bottom) {
markerIndex = this._terminal.markers.length - 1;
} else if (this._currentMarker === Boundary.Top) {
markerIndex = -1;
......@@ -95,7 +106,18 @@ export class CommandTrackerAddon implements ICommandTracker, ITerminalAddon {
}
let markerIndex;
if (this._currentMarker === Boundary.Bottom) {
const currentLineY = Math.min(this._getLine(this._terminal, this._currentMarker), this._terminal.buffer.baseY);
const viewportY = this._terminal.buffer.viewportY;
if (!retainSelection && currentLineY !== viewportY) {
// The user has scrolled, find the line based on the current scroll position. This only
// works when not retaining selection
const markersAboveViewport = this._terminal.markers.filter(e => e.line <= viewportY).length;
if (markersAboveViewport < this._terminal.markers.length) {
markerIndex = markersAboveViewport;
} else {
markerIndex = this._terminal.markers.length;
}
} else if (this._currentMarker === Boundary.Bottom) {
markerIndex = this._terminal.markers.length;
} else if (this._currentMarker === Boundary.Top) {
markerIndex = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册