mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
parent
22f3839b94
commit
5b3380c48e
|
@ -259,21 +259,36 @@ export async function showRunRecentQuickPick(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let terminalScrollStateSaved = false;
|
let terminalScrollStateSaved = false;
|
||||||
|
function restoreScrollState() {
|
||||||
|
terminalScrollStateSaved = false;
|
||||||
|
instance.xterm?.markTracker.restoreScrollState();
|
||||||
|
instance.xterm?.markTracker.clear();
|
||||||
|
}
|
||||||
quickPick.onDidChangeActive(async () => {
|
quickPick.onDidChangeActive(async () => {
|
||||||
const xterm = instance.xterm;
|
const xterm = instance.xterm;
|
||||||
if (!xterm) {
|
if (!xterm) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const [item] = quickPick.activeItems;
|
const [item] = quickPick.activeItems;
|
||||||
if ('command' in item && item.command) {
|
if ('command' in item && item.command && item.command.marker) {
|
||||||
if (!terminalScrollStateSaved) {
|
if (!terminalScrollStateSaved) {
|
||||||
xterm.markTracker.saveScrollState();
|
xterm.markTracker.saveScrollState();
|
||||||
terminalScrollStateSaved = true;
|
terminalScrollStateSaved = true;
|
||||||
}
|
}
|
||||||
xterm.markTracker.revealCommand(item.command);
|
const promptRowCount = item.command.getPromptRowCount();
|
||||||
|
const commandRowCount = item.command.getCommandRowCount();
|
||||||
|
xterm.markTracker.revealRange({
|
||||||
|
start: {
|
||||||
|
x: 1,
|
||||||
|
y: item.command.marker.line - (promptRowCount - 1) + 1
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
x: instance.cols,
|
||||||
|
y: item.command.marker.line + (commandRowCount - 1) + 1
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
terminalScrollStateSaved = false;
|
restoreScrollState();
|
||||||
xterm.markTracker.restoreScrollState();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
quickPick.onDidAccept(async () => {
|
quickPick.onDidAccept(async () => {
|
||||||
|
@ -289,13 +304,9 @@ export async function showRunRecentQuickPick(
|
||||||
if (quickPick.keyMods.alt) {
|
if (quickPick.keyMods.alt) {
|
||||||
instance.focus();
|
instance.focus();
|
||||||
}
|
}
|
||||||
terminalScrollStateSaved = false;
|
restoreScrollState();
|
||||||
instance.xterm?.markTracker.restoreScrollState();
|
|
||||||
});
|
|
||||||
quickPick.onDidHide(() => {
|
|
||||||
terminalScrollStateSaved = false;
|
|
||||||
instance.xterm?.markTracker.restoreScrollState();
|
|
||||||
});
|
});
|
||||||
|
quickPick.onDidHide(() => restoreScrollState());
|
||||||
if (value) {
|
if (value) {
|
||||||
quickPick.value = value;
|
quickPick.value = value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue