Skip to content

Fix terminal quick fix bugs #247345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

meganrogge
Copy link
Contributor

@meganrogge meganrogge commented Apr 24, 2025

Fixes at least two cases of #211857

Previously, both the Create PR and Push Upstream terminal quick fixes required the command line to match a specific regex:

However, in certain cases, the captured commandLine was incorrectly set to gitpush instead of git push. This occurred when the user entered git and push on separate lines — such as when a command wrapped due to line length.

Wrapped command

During the execute phase, the command was correctly recognized. But by the finished phase, the space had been lost, breaking the match:

Incorrect by finished

The issue was caused by prematurely trimming whitespace before combining wrapped lines — which accidentally removed the space between command parts. We now apply trim() after assembling the full logical command line:

currentCommand.command = this._hooks.isCommandStorageDisabled ? '' : this._terminal.buffer.active.getLine(currentCommand.commandStartMarker.line)?.translateToString(false, currentCommand.commandStartX, currentCommand.commandRightPromptStartX);

This resolves the previously reproducible git push failure case. It may also fix additional command-wrapping issues that previously failed to match the expected regex.

Working case

@meganrogge meganrogge requested a review from Tyriar April 24, 2025 21:10
@meganrogge meganrogge self-assigned this Apr 24, 2025
@meganrogge meganrogge added this to the June 2025 milestone Apr 24, 2025
@meganrogge meganrogge changed the title fix longstanding, annoying terminal quick fix bugs Fix terminal quick fix bugs Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant