Skip to content

Commit 36e5971

Browse files
committed
Test ghost text in recorded test
1 parent 74f2888 commit 36e5971

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export class PromptInputModel extends Disposable implements IPromptInputModel {
149149
// Detect ghost text by looking for italic or dim text in or after the cursor and
150150
// non-italic/dim text in the cell closest non-whitespace cell before the cursor
151151
if (absoluteCursorY === commandStartY && buffer.cursorX > 1) {
152+
// Ghost text in pwsh only appears to happen on the cursor line
152153
this._ghostTextIndex = this._scanForGhostText(buffer, line);
153154
}
154155

src/vs/platform/terminal/test/common/capabilities/commandDetection/promptInputModel.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ suite('PromptInputModel', () => {
4646

4747
promptInputModel.forceSync();
4848

49-
const actualValueWithCursor = promptInputModel.value.substring(0, promptInputModel.cursorIndex) + '|' + promptInputModel.value.substring(promptInputModel.cursorIndex);
49+
const actualValueWithCursor = promptInputModel.getCombinedString();
5050
strictEqual(
5151
actualValueWithCursor.replaceAll('\n', '\u23CE'),
5252
valueWithCursor.replaceAll('\n', '\u23CE')
5353
);
5454

5555
// This is required to ensure the cursor index is correctly resolved for non-ascii characters
56-
const value = valueWithCursor.replace('|', '');
56+
const value = valueWithCursor.replace(/[\|\[\]]/g, '');
5757
const cursorIndex = valueWithCursor.indexOf('|');
5858
strictEqual(promptInputModel.value, value);
5959
strictEqual(promptInputModel.cursorIndex, cursorIndex, `value=${promptInputModel.value}`);
@@ -222,31 +222,31 @@ suite('PromptInputModel', () => {
222222
'[?25lecho "hello world"[?25h',
223223
'',
224224
]);
225-
assertPromptInput('e|cho "hello world"');
225+
assertPromptInput('e|[cho "hello world"]');
226226

227227
await replayEvents([
228228
'[?25lecho "hello world"[?25h',
229229
'',
230230
]);
231-
assertPromptInput('ec|ho "hello world"');
231+
assertPromptInput('ec|[ho "hello world"]');
232232

233233
await replayEvents([
234234
'[?25lecho "hello world"[?25h',
235235
'',
236236
]);
237-
assertPromptInput('ech|o "hello world"');
237+
assertPromptInput('ech|[o "hello world"]');
238238

239239
await replayEvents([
240240
'[?25lecho "hello world"[?25h',
241241
'',
242242
]);
243-
assertPromptInput('echo| "hello world"');
243+
assertPromptInput('echo|[ "hello world"]');
244244

245245
await replayEvents([
246246
'[?25lecho "hello world"[?25h',
247247
'',
248248
]);
249-
assertPromptInput('echo |"hello world"');
249+
assertPromptInput('echo |["hello world"]');
250250

251251
await replayEvents([
252252
'[?25lecho "hello world"[?25h',

0 commit comments

Comments
 (0)