diff --git a/src/PoshGitTypes.ps1 b/src/PoshGitTypes.ps1 index fcd0d5b08..64e1e6ce4 100644 --- a/src/PoshGitTypes.ps1 +++ b/src/PoshGitTypes.ps1 @@ -271,7 +271,7 @@ class PoshGitPromptSettings { [string[]]$RepositoriesInWhichToDisableFileStatus = @() [string]$DescribeStyle = '' - [psobject]$WindowTitle = {param($GitStatus, [bool]$IsAdmin) "$(if ($IsAdmin) {'Administrator: '})$(if ($GitStatus) {"posh~git ~ $($GitStatus.RepoName) [$($GitStatus.Branch)] ~ "})PowerShell $($PSVersionTable.PSVersion) $([IntPtr]::Size * 8)-bit ($PID)"} + [psobject]$WindowTitle = {param($GitStatus, [bool]$IsAdmin) "$(if ($IsAdmin) {'Admin: '})$(if ($GitStatus) {"$($GitStatus.RepoName) [$($GitStatus.Branch)]"} else {Get-PromptPath}) - PowerShell $($PSVersionTable.PSVersion) $([IntPtr]::Size * 8)-bit ($PID)"} [PoshGitTextSpan]$DefaultPromptPrefix = '' [PoshGitTextSpan]$DefaultPromptPath = '$(Get-PromptPath)' diff --git a/src/Utils.ps1 b/src/Utils.ps1 index c0047de6d..d0a27c04e 100644 --- a/src/Utils.ps1 +++ b/src/Utils.ps1 @@ -300,8 +300,10 @@ function Get-PromptPath { $stringComparison = Get-PathStringComparison - # Abbreviate path by replacing beginning of path with ~ *iff* the path is in the user's home dir - if ($abbrevHomeDir -and $currentPath -and $currentPath.StartsWith($Home, $stringComparison)) { + # Abbreviate path by replacing beginning of path with ~ *iff* the path is under the user's home dir + if ($abbrevHomeDir -and $currentPath -and !$currentPath.Equals($Home, $stringComparison) -and + $currentPath.StartsWith($Home, $stringComparison)) { + $currentPath = "~" + $currentPath.SubString($Home.Length) }