Skip to content

Commit 6f741c5

Browse files
committed
Startup improvements
- Delay loading resources until they are used - Delay creating vi mode key handler tables - Remove format.ps1xml file
1 parent 618b497 commit 6f741c5

File tree

6 files changed

+250
-300
lines changed

6 files changed

+250
-300
lines changed

MakeRelease.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ $files = @('PSReadline\Changes.txt',
2424
'PSReadline\SamplePSReadlineProfile.ps1',
2525
'PSReadline\PSReadline.psd1',
2626
'PSReadline\PSReadline.psm1',
27-
'PSReadline\PSReadline.format.ps1xml',
2827
'PSReadline\bin\Release\Microsoft.PowerShell.PSReadline.dll')
2928

3029
foreach ($file in $files)

PSReadLine/KeyBindings.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,17 @@ class KeyHandler
6464
// (e.g. as a repeat count) or a string. Most actions will ignore this argument.
6565
public Action<ConsoleKeyInfo?, object> Action;
6666
public string BriefDescription;
67-
public string LongDescription;
67+
public string LongDescription
68+
{
69+
get
70+
{
71+
return _longDescription ??
72+
(_longDescription =
73+
PSReadLineResources.ResourceManager.GetString(BriefDescription + "Description"));
74+
}
75+
set { _longDescription = value; }
76+
}
77+
private string _longDescription;
6878
public ScriptBlock ScriptBlock;
6979
}
7080

@@ -83,9 +93,6 @@ public int GetHashCode(ConsoleKeyInfo obj)
8393

8494
static KeyHandler MakeKeyHandler(Action<ConsoleKeyInfo?, object> action, string briefDescription, string longDescription = null, ScriptBlock scriptBlock = null)
8595
{
86-
if (string.IsNullOrWhiteSpace(longDescription))
87-
longDescription = PSReadLineResources.ResourceManager.GetString(briefDescription + "Description");
88-
8996
return new KeyHandler
9097
{
9198
Action = action,

0 commit comments

Comments
 (0)