Skip to content

Commit

Permalink
re-evaluate ghost text after trim (#241111)
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge authored Feb 19, 2025
1 parent 7c94c94 commit 03c100c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@ export class PromptInputModel extends Disposable implements IPromptInputModel {

if (ghostTextIndex > -1 && this.value.substring(ghostTextIndex).endsWith(' ')) {
this._value = this.value.trim();
if (!this.value.substring(ghostTextIndex)) {
ghostTextIndex = -1;
}
}
return ghostTextIndex;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ suite('PromptInputModel', () => {
await writePromise('\x1b[2D');
await assertPromptInput('f|oo[ bar]');
});
test('trailing whitespace', async () => {
await writePromise('$ ');
fireCommandStart();
await assertPromptInput('|');
await writePromise('foo ');
await writePromise('\x1b[4D');
await assertPromptInput('foo| ');
});
test('basic ghost text one word', async () => {
await writePromise('$ ');
fireCommandStart();
Expand Down

0 comments on commit 03c100c

Please sign in to comment.