diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs index c47b0506e92..de68e374bf5 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs @@ -62,7 +62,33 @@ internal static void ShowUpdateNotification(PSHostUserInterface hostUI) ? ManagedEntranceStrings.StableUpdateNotificationMessage : ManagedEntranceStrings.PreviewUpdateNotificationMessage; - string notificationMsg = string.Format(CultureInfo.CurrentCulture, notificationMsgTemplate, releaseTag); + string notificationColor = string.Empty; + string resetColor = string.Empty; + + string line2Padding = string.Empty; + string line3Padding = string.Empty; + + // We calculate how much whitespace we need to make it look nice + if (hostUI.SupportsVirtualTerminal) + { + // Use Warning Color + notificationColor = "\x1B[7m"; + resetColor = "\x1B[0m"; + + // The first line is longest, if the message changes, this needs to be updated + int line1Length = notificationMsgTemplate.IndexOf('\n'); + int line2Length = notificationMsgTemplate.IndexOf('\n', line1Length + 1); + int line3Length = notificationMsgTemplate.IndexOf('\n', line2Length + 1); + line3Length -= line2Length + 1; + line2Length -= line1Length + 1; + + line2Padding = line2Padding.PadRight(line1Length - line2Length + releaseTag.Length); + // 3 represents the extra placeholder in the template + line3Padding = line3Padding.PadRight(line1Length - line3Length + 3); + } + + string notificationMsg = string.Format(CultureInfo.CurrentCulture, notificationMsgTemplate, releaseTag, notificationColor, resetColor, line2Padding, line3Padding); + hostUI.WriteLine(notificationMsg); } } diff --git a/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx b/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx index 5d5feaaf761..5a64d207a8d 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx +++ b/src/Microsoft.PowerShell.ConsoleHost/resources/ManagedEntranceStrings.resx @@ -128,15 +128,15 @@ Type 'help' to get help. Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes. If you want to re-enable it, run 'Import-Module PSReadLine'. - !! A new PowerShell preview release is available: v{0} !! -Upgrade now, or check out the release page at: -https://github.com/PowerShell/PowerShell/releases/tag/v{0} + {1} A new PowerShell preview release is available: v{0} {2} + {1} Upgrade now, or check out the release page at:{3}{2} + {1} https://aka.ms/PowerShell-Release?tag=v{0} {4}{2} - !! A new PowerShell stable release is available: v{0} !! -Upgrade now, or check out the release page at: -https://github.com/PowerShell/PowerShell/releases/tag/v{0} + {1} A new PowerShell stable release is available: v{0} {2} + {1} Upgrade now, or check out the release page at:{3}{2} + {1} https://aka.ms/PowerShell-Release?tag=v{0} {4}{2}