Skip to content

Commit c524eef

Browse files
committed
fix: starship prompt issues
Signed-off-by: Chapman Pendery <[email protected]>
1 parent 1b0816d commit c524eef

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,14 +733,14 @@ class WindowsPtyHeuristics extends Disposable {
733733
// Adjust the prompt start marker to the command start marker
734734
this._logService.debug('CommandDetectionCapability#_tryAdjustCommandStartMarker adjusted promptStart', `${this._capability.currentCommand.promptStartMarker?.line} -> ${this._capability.currentCommand.commandStartMarker.line}`);
735735
this._capability.currentCommand.promptStartMarker?.dispose();
736-
this._capability.currentCommand.promptStartMarker = cloneMarker(this._terminal, this._capability.currentCommand.commandStartMarker, -(this._capability.currentCommand.promptHeight ?? 0));
736+
this._capability.currentCommand.promptStartMarker = cloneMarker(this._terminal, this._capability.currentCommand.commandStartMarker, -((this._capability.currentCommand.promptHeight ?? 1) - 1));
737737

738738
// Adjust the last command if it's not in the same position as the following
739739
// prompt start marker
740740
const lastCommand = this._capability.commands.at(-1);
741741
if (lastCommand && this._capability.currentCommand.commandStartMarker.line !== lastCommand.endMarker?.line) {
742742
lastCommand.endMarker?.dispose();
743-
lastCommand.endMarker = cloneMarker(this._terminal, this._capability.currentCommand.commandStartMarker, -(this._capability.currentCommand.promptHeight ?? 0));
743+
lastCommand.endMarker = cloneMarker(this._terminal, this._capability.currentCommand.commandStartMarker, -((this._capability.currentCommand.promptHeight ?? 1) - 1));
744744
}
745745

746746
// use the regex to set the position as it's possible input has occurred
@@ -1070,5 +1070,5 @@ function getXtermLineContent(buffer: IBuffer, lineStart: number, lineEnd: number
10701070
function cloneMarker(xterm: Terminal, marker: IXtermMarker, offset: number = 0): IXtermMarker | undefined {
10711071
const cursorY = xterm.buffer.active.baseY + xterm.buffer.active.cursorY;
10721072
const cursorYOffset = marker.line - cursorY + offset;
1073-
return xterm.registerMarker((cursorY + cursorYOffset) < 0 ? 0 : cursorYOffset);
1073+
return xterm.registerMarker((cursorY + cursorYOffset) < 0 ? -cursorY : cursorYOffset);
10741074
}

src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function Global:Prompt() {
9595

9696
# Prompt height
9797
# OSC 633 ; <Property>=<Value> ST
98-
$Result += "$([char]0x1b)]633;P;PromptHeight=$(__VSCode-Escape-Value ($OriginalPrompt -Split '\n').Count)`a"
98+
$Result += "$([char]0x1b)]633;P;PromptHeight=$(__VSCode-Escape-Value ($OriginalPrompt -Split '\n').Count - 1)`a"
9999

100100
# Write command started
101101
$Result += "$([char]0x1b)]633;B`a"

0 commit comments

Comments
 (0)