diff --git a/src/PoshGitTypes.ps1 b/src/PoshGitTypes.ps1 index 65636ebb2..c078a1919 100644 --- a/src/PoshGitTypes.ps1 +++ b/src/PoshGitTypes.ps1 @@ -222,6 +222,7 @@ class PoshGitTextSpan { class PoshGitPromptSettings { [bool]$AnsiConsole = $Host.UI.SupportsVirtualTerminal -or ($Env:ConEmuANSI -eq "ON") + [bool]$SetEnvColumns = $true [PoshGitCellColor]$DefaultColor = [PoshGitCellColor]::new() [PoshGitCellColor]$BranchColor = [PoshGitCellColor]::new([ConsoleColor]::Cyan) diff --git a/src/posh-git.psm1 b/src/posh-git.psm1 index e3e4439b3..1c360fdb4 100644 --- a/src/posh-git.psm1 +++ b/src/posh-git.psm1 @@ -40,6 +40,11 @@ $GitPromptScriptBlock = { $origLastExitCode = $global:LASTEXITCODE + if ($settings.SetEnvColumns) { + # Set COLUMNS so git knows how wide the terminal is + $Env:COLUMNS = $Host.UI.RawUI.WindowSize.Width + } + # Construct/write the prompt text $prompt = ''