From ee0aff2460957b825fb4ce2edc3a6d21c90c2c04 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 28 Oct 2020 10:15:28 -0700 Subject: [PATCH] fix: don't predict git log/less Fixes https://github.com/microsoft/vscode/issues/109541 --- .../contrib/terminal/browser/terminalTypeAheadAddon.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon.ts b/src/vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon.ts index 05f75c63b7fe6..bde39712d1828 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon.ts @@ -962,6 +962,14 @@ export class TypeAheadAddon extends Disposable implements ITerminalAddon { const terminal = this.timeline.terminal; const buffer = terminal.buffer.active; + // Detect programs like git log/less that use the normal buffer but don't + // take input by deafult (fixes #109541) + if (buffer.cursorX === 1 && buffer.cursorY === terminal.rows - 1) { + if (buffer.getLine(buffer.cursorY + buffer.baseY)?.getCell(0)?.getChars() === ':') { + return; + } + } + // the following code guards the terminal prompt to avoid being able to // arrow or backspace-into the prompt. Record the lowest X value at which // the user gave input, and mark all additions before that as tentative.