/// <summary> /// Pushes an input handler onto the list of stacked input handlers. /// </summary> /// <remarks><inheritdoc cref="ITextAreaInputHandler"/></remarks> public void PushStackedInputHandler(TextAreaStackedInputHandler inputHandler) { if (inputHandler == null) { throw new ArgumentNullException("inputHandler"); } stackedInputHandlers = stackedInputHandlers.Push(inputHandler); inputHandler.Attach(); }
/// <summary> /// Pops the stacked input handler (and all input handlers above it). /// If <paramref name="inputHandler"/> is not found in the currently stacked input handlers, or is null, this method /// does nothing. /// </summary> /// <remarks><inheritdoc cref="ITextAreaInputHandler"/></remarks> public void PopStackedInputHandler(TextAreaStackedInputHandler inputHandler) { if (stackedInputHandlers.Any(i => i == inputHandler)) { ITextAreaInputHandler oldHandler; do { oldHandler = stackedInputHandlers.Peek(); stackedInputHandlers = stackedInputHandlers.Pop(); oldHandler.Detach(); } while (oldHandler != inputHandler); } }