Skip to content

Commit 29c5839

Browse files
committed
Fix matching against unwrapped lines
Part of microsoft#162070
1 parent 7fc4f97 commit 29c5839

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,15 +663,27 @@ export function getOutputMatchForCommand(executedMarker: IMarker | undefined, en
663663
let line: string | undefined;
664664
if (outputMatcher?.anchor === 'bottom') {
665665
for (let i = endLine - (outputMatcher.offset || 0); i >= startLine; i--) {
666-
line = getXtermLineContent(buffer, i, i, cols);
666+
let wrappedLineStart = i;
667+
const wrappedLineEnd = i;
668+
while (wrappedLineStart >= startLine && buffer.getLine(wrappedLineStart)?.isWrapped) {
669+
wrappedLineStart--;
670+
}
671+
i = wrappedLineStart;
672+
line = getXtermLineContent(buffer, wrappedLineStart, wrappedLineEnd, cols);
667673
const match = line.match(outputMatcher.lineMatcher);
668674
if (match) {
669675
return match;
670676
}
671677
}
672678
} else {
673679
for (let i = startLine + (outputMatcher?.offset || 0); i < endLine; i++) {
674-
line = getXtermLineContent(buffer, i, i, cols);
680+
const wrappedLineStart = i;
681+
let wrappedLineEnd = i;
682+
while (wrappedLineEnd + 1 < endLine && buffer.getLine(wrappedLineEnd + 1)?.isWrapped) {
683+
wrappedLineEnd++;
684+
}
685+
i = wrappedLineEnd;
686+
line = getXtermLineContent(buffer, wrappedLineStart, wrappedLineEnd, cols);
675687
if (outputMatcher) {
676688
const match = line.match(outputMatcher.lineMatcher);
677689
if (match) {

0 commit comments

Comments
 (0)