Change:
<!-- Do Not Delete This! featurerequesttemplate --<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Describe the feature you'd like. --The awesome shell integration makes it really easy to rerun commands and copy the output from those commands. However, it seems one can only copy the output if the line the command was executed from is still within the scroll limit of the terminal. For some very long runs this is inconvenient. It would be really nice to be able to: output of last command from a terminal output of any command in the history of that terminal, if it is available to be copied Both without having to scroll to the point the command was executed.
Once there is too much data we no longer have access to it. Sounds like you probably want to increase the size of your scrollback. This is what I use: All the memory for the buffer gets reserved ahead of time for performance reasons so this will increase RAM usage by a fixed amount per terminal you have open. I like the idea of having a command for copying the output of the last command that you could hook up to a keybinding
You can also get the output from a command via and then click the output/document icon <img width="644" alt="Screen Shot 2022-06-14 at 12 31 30 PM" src="https://user-"These are only stored for the session, but might help you. I don't believe we get rid of commands that are outside of the scrollback, do we?
I don't think so but we do lose access to their output
I wonder if the command name should change makes you think the command would be copied but instead this is to copy the output

Discussion:
*/ copySelection(asHtml?: boolean, command?: ITerminalCommand): Promise<void>; <ins> /** * Copies the ouput of the last command */ copyLastCommandOutput(): Promise<void>; </ins> /** * Current selection in the terminal. */

registerAction2(class extends Action2 { constructor() { super({ <ins> id: TerminalCommandId.CopyLastCommand, title: { value: localize('workbench.action.terminal.copyLastCommand', 'Copy Last Command'), original: 'Copy Last Command' }, f1: true, category, precondition: ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated) }); } async run(accessor: ServicesAccessor): Promise<void> { await accessor.get(ITerminalService).activeInstance?.copyLastCommandOutput(); } }); registerAction2(class extends Action2 { constructor() { super({ </ins> id: TerminalCommandId.GoToRecentDirectory, title: { value: localize('workbench.action.terminal.goToRecentDirectory', "Go to Recent Directory..."), original: 'Go to Recent Directory...' }, f1: true,

} } <ins> async copyLastCommandOutput(): Promise<void> { const commands = this.capabilities.get(TerminalCapability.CommandDetection)?.commands; if (!commands || commands.length === 0) { return; } const command = commands[commands.length - 1]; if (!command?.hasOutput) { return; } const output = command.getOutput(); if (output) { await this._clipboardService.writeText(output); } } </ins> get selection(): string | undefined { return this.xterm && this.hasSelection() ? this.xterm.raw.getSelection() : undefined; }

OpenFileLink = 'workbench.action.terminal.openFileLink', OpenWebLink = 'workbench.action.terminal.openUrlLink', RunRecentCommand = 'workbench.action.terminal.runRecentCommand', <ins> CopyLastCommand = 'workbench.action.terminal.copyLastCommand', </ins> GoToRecentDirectory = 'workbench.action.terminal.goToRecentDirectory', CopySelection = 'workbench.action.terminal.copySelection', CopySelectionAsHtml = 'workbench.action.terminal.copySelectionAsHtml',

TerminalCommandId.Clear, TerminalCommandId.CopySelection, TerminalCommandId.CopySelectionAsHtml, <ins> TerminalCommandId.CopyLastCommand, </ins> TerminalCommandId.DeleteToLineStart, TerminalCommandId.DeleteWordLeft, TerminalCommandId.DeleteWordRight,