Exemplo n.º 1
0
        /// <summary>
        /// Accept the suggestion text if there is one.
        /// </summary>
        public static void AcceptSuggestion(ConsoleKeyInfo?key = null, object arg = null)
        {
            Prediction prediction = _singleton._prediction;

            if (prediction.ActiveView is PredictionInlineView inlineView && inlineView.HasActiveSuggestion)
            {
                // Ignore the visual selection.
                _singleton._visualSelectionCommandCount = 0;

                inlineView.OnSuggestionAccepted();

                using var _ = prediction.DisableScoped();
                Replace(0, _singleton._buffer.Length, inlineView.SuggestionText);
            }
        }