File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,6 @@ public PSConsoleReadLineOptions(string hostName)
159
159
ExtraPromptLineCount = DefaultExtraPromptLineCount ;
160
160
AddToHistoryHandler = DefaultAddToHistoryHandler ;
161
161
HistoryNoDuplicates = DefaultHistoryNoDuplicates ;
162
- MaximumHistoryCount = DefaultMaximumHistoryCount ;
163
162
MaximumKillRingCount = DefaultMaximumKillRingCount ;
164
163
HistorySearchCursorMovesToEnd = DefaultHistorySearchCursorMovesToEnd ;
165
164
ShowToolTips = DefaultShowToolTips ;
@@ -172,6 +171,7 @@ public PSConsoleReadLineOptions(string hostName)
172
171
HistorySaveStyle = DefaultHistorySaveStyle ;
173
172
AnsiEscapeTimeout = DefaultAnsiEscapeTimeout ;
174
173
PredictionSource = DefaultPredictionSource ;
174
+ MaximumHistoryCount = 0 ;
175
175
176
176
var historyFileName = hostName + "_history.txt" ;
177
177
if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
Original file line number Diff line number Diff line change @@ -757,10 +757,13 @@ private void DelayedOneTimeInitialize()
757
757
// specifies a custom history save file, we don't want to try reading
758
758
// from the default one.
759
759
760
- var historyCountVar = _engineIntrinsics ? . SessionState . PSVariable . Get ( "MaximumHistoryCount" ) ;
761
- if ( historyCountVar ? . Value is int historyCountValue )
760
+ if ( _options . MaximumHistoryCount == 0 )
762
761
{
763
- _options . MaximumHistoryCount = historyCountValue ;
762
+ // Initialize 'MaximumHistoryCount' if it's not defined in user's profile.
763
+ var historyCountVar = _engineIntrinsics ? . SessionState . PSVariable . Get ( "MaximumHistoryCount" ) ;
764
+ _options . MaximumHistoryCount = ( historyCountVar ? . Value is int historyCountValue )
765
+ ? historyCountValue
766
+ : PSConsoleReadLineOptions . DefaultMaximumHistoryCount ;
764
767
}
765
768
766
769
if ( _options . PromptText == null &&
You can’t perform that action at this time.
0 commit comments