Skip to content

Commit 5204b85

Browse files
authored
Fix the env-data script and write buffer info in case of exception (#1482)
1 parent 60bd4c0 commit 5204b85

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

.github/ISSUE_TEMPLATE/Bug_Report.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@ Please run the script in the PowerShell session where you ran into the issue and
4646
}
4747
4848
"`nPS version: $($PSVersionTable.PSVersion)"
49-
$v = (Get-Module PSReadline).Version
50-
$m = Get-Content "$(Split-Path -Parent (Get-Module PSReadLine).Path)\PSReadLine.psd1" | Select-String "Prerelease = '(.*)'"
51-
if ($m) {
52-
$v = "$v-" + $m.Matches[0].Groups[1].Value
53-
}
49+
$m = Get-Module PSReadline
50+
$v = $m.Version; $pre = $m.PrivateData.PSData.Prerelease
51+
if ($pre) { $v = "$v-$pre" }
5452
"PSReadline version: $v"
5553
if ($IsLinux -or $IsMacOS) {
5654
"os: $(uname -a)"

PSReadLine/PSReadLineResources.resx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,16 @@ Report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=B
397397
PSReadLine: {0}
398398
PowerShell: {1}
399399
OS: {2}
400-
Last {3} Keys
400+
BufferWidth: {3}
401+
BufferHeight: {4}
402+
Last {5} Keys
401403
```
402-
{4}
404+
{6}
403405
```
404406

405407
### Exception
406408
```
407-
{5}
409+
{7}
408410
```
409411
</value>
410412
</data>

PSReadLine/ReadLine.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,11 @@ public static string ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsi
419419
var psVersion = PSObject.AsPSObject(engineIntrinsics.Host.Version).ToString();
420420
var ourVersion = typeof(PSConsoleReadLine).Assembly.GetCustomAttributes<AssemblyInformationalVersionAttribute>().First().InformationalVersion;
421421
var osInfo = RuntimeInformation.OSDescription;
422+
var bufferWidth = console.BufferWidth;
423+
var bufferHeight = console.BufferHeight;
422424

423425
console.WriteLine(string.Format(CultureInfo.CurrentUICulture, PSReadLineResources.OopsAnErrorMessage2,
424-
ourVersion, psVersion, osInfo,
426+
ourVersion, psVersion, osInfo, bufferWidth, bufferHeight,
425427
_lastNKeys.Count, sb, e));
426428
var lineBeforeCrash = _singleton._buffer.ToString();
427429
_singleton.Initialize(runspace, _singleton._engineIntrinsics);

0 commit comments

Comments
 (0)