/// <summary> /// Write a warning message if the current window size is too small for the specified prediction view. /// </summary> internal static void WarnWhenWindowSizeTooSmallForView(PredictionViewStyle viewStyle, PSCmdlet cmdlet) { if (viewStyle != PredictionViewStyle.ListView) { return; } var console = _singleton._console; var minWidth = PredictionListView.MinWindowWidth; var minHeight = PredictionListView.MinWindowHeight; if (console.WindowWidth < minWidth || console.WindowHeight < minHeight) { cmdlet.WriteWarning(string.Format(PSReadLineResources.WindowSizeTooSmallForListView, minWidth, minHeight)); } }
/// <summary> /// Set the active prediction view style. /// </summary> internal void SetViewStyle(PredictionViewStyle style) { ActiveView?.Reset(); switch (style) { case PredictionViewStyle.InlineView: _inlineView ??= new PredictionInlineView(_singleton); ActiveView = _inlineView; break; case PredictionViewStyle.ListView: _listView ??= new PredictionListView(_singleton); ActiveView = _listView; break; default: throw new ArgumentOutOfRangeException(nameof(style)); } }