Change:
Setup a right prompt in fish/zsh and make sure the command detected is accurate.
zsh uses for this, perhaps we should have a generic ignored ranges mechanism and combine this with the line continuation solution?

Discussion:
handlePromptStart(): void; handleContinuationStart(): void; handleContinuationEnd(): void; <ins> handleRightPromptStart(): void; handleRightPromptEnd(): void; </ins> handleCommandStart(): void; handleCommandExecuted(): void; handleCommandFinished(exitCode: number | undefined): void;

commandStartMarker?: IMarker; commandStartX?: number; <ins> commandRightPromptStartX?: number; commandRightPromptEndX?: number; </ins> commandLines?: IMarker; commandExecutedMarker?: IMarker;

this._logService.debug('CommandDetectionCapability#handleContinuationEnd', this._currentCommand.continuations[this._currentCommand.continuations.length - 1]); } <ins> handleRightPromptStart(): void { this._currentCommand.commandRightPromptStartX = this._terminal.buffer.active.cursorX; this._logService.debug('CommandDetectionCapability#handleRightPromptStart', this._currentCommand.commandRightPromptStartX); } handleRightPromptEnd(): void { this._currentCommand.commandRightPromptEndX = this._terminal.buffer.active.cursorX; this._logService.debug('CommandDetectionCapability#handleRightPromptEnd', this._currentCommand.commandRightPromptEndX); } </ins> handleCommandStart(): void { this._currentCommand.commandStartX = this._terminal.buffer.active.cursorX;

} // Calculate the command <del> this._currentCommand.command = this._terminal.buffer.active.getLine(this._currentCommand.commandStartMarker.line)?.translateToString(true, this._currentCommand.commandStartX); </del> <ins> this._currentCommand.command = this._terminal.buffer.active.getLine(this._currentCommand.commandStartMarker.line)?.translateToString(true, this._currentCommand.commandStartX, this._currentCommand.commandRightPromptStartX).trim(); </ins> let y = this._currentCommand.commandStartMarker.line + 1; const commandExecutedLine = this._currentCommand.commandExecutedMarker.line; for (; y < commandExecutedLine; y++) {

ContinuationEnd = 'G', /** <ins> * The start of the right prompt. */ RightPromptStart = 'H', /** * The end of the right prompt. */ RightPromptEnd = 'I', /** </ins> * Set an arbitrary property: `OSC 633 ; P ; <Property>=<Value> ST`, only known properties will * be handled. */

this._createOrGetCommandDetection(this._terminal).handleContinuationEnd(); return true; } <ins> case VSCodeOscPt.RightPromptStart: { this._createOrGetCommandDetection(this._terminal).handleRightPromptStart(); return true; } case VSCodeOscPt.RightPromptEnd: { this._createOrGetCommandDetection(this._terminal).handleRightPromptEnd(); return true; } </ins> case VSCodeOscPt.Property: { const [key, value] = args[0].split('='); switch (key) {

printf "033]633;G007" } <ins> right_prompt_start() { printf "033]633;H007" } right_prompt_end() { printf "033]633;I007" } </ins> command_complete() { local HISTORY_ID=$(history | tail -n1 | awk '{print $1;}') if [[ "$HISTORY_ID" == "$LAST_HISTORY_ID" ]]; then

IN_COMMAND_EXECUTION="" PS1="%{$(prompt_start)%}$PREFIX$PS1%{$(prompt_end)%}" PS2="%{$(continuation_start)%}$PS2%{$(continuation_end)%}" <ins> if [ -n "$RPROMPT" ]; then PRIOR_RPROMPT="$RPROMPT" RPROMPT="%{$(right_prompt_start)%}$RPROMPT%{$(right_prompt_end)%}" fi </ins> } precmd() {

preexec() { PS1="$PRIOR_PROMPT" <ins> if [ -n "$RPROMPT" ]; then RPROMPT="$PRIOR_RPROMPT" fi </ins> IN_COMMAND_EXECUTION="1" command_output_start }