File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 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)
159159 ExtraPromptLineCount = DefaultExtraPromptLineCount ;
160160 AddToHistoryHandler = DefaultAddToHistoryHandler ;
161161 HistoryNoDuplicates = DefaultHistoryNoDuplicates ;
162- MaximumHistoryCount = DefaultMaximumHistoryCount ;
163162 MaximumKillRingCount = DefaultMaximumKillRingCount ;
164163 HistorySearchCursorMovesToEnd = DefaultHistorySearchCursorMovesToEnd ;
165164 ShowToolTips = DefaultShowToolTips ;
@@ -172,6 +171,7 @@ public PSConsoleReadLineOptions(string hostName)
172171 HistorySaveStyle = DefaultHistorySaveStyle ;
173172 AnsiEscapeTimeout = DefaultAnsiEscapeTimeout ;
174173 PredictionSource = DefaultPredictionSource ;
174+ MaximumHistoryCount = 0 ;
175175
176176 var historyFileName = hostName + "_history.txt" ;
177177 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
Original file line number Diff line number Diff line change @@ -757,10 +757,13 @@ private void DelayedOneTimeInitialize()
757757 // specifies a custom history save file, we don't want to try reading
758758 // from the default one.
759759
760- var historyCountVar = _engineIntrinsics ? . SessionState . PSVariable . Get ( "MaximumHistoryCount" ) ;
761- if ( historyCountVar ? . Value is int historyCountValue )
760+ if ( _options . MaximumHistoryCount == 0 )
762761 {
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 ;
764767 }
765768
766769 if ( _options . PromptText == null &&
You can’t perform that action at this time.
0 commit comments