コード例 #1
0
        public Task ExecuteAsync(AsyncData data, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            var @char = FastConvert.Utf8ByteArrayToChar(data.GetFirst());

            session.ReplaceText(FastConvert.CharToString(@char), session.CursorPosition, 0);
            session.CursorPosition += 1;

            return(_effects.ApplyTypedCharAsync(@char, session, sender, cancellationToken));
        }
コード例 #2
0
        public Task ApplyReplacedTextAsync(string reason, ITypedCharEffects typedCharEffects, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
        {
            if (reason != ChangeReasonCompletion)
            {
                return(Task.CompletedTask);
            }

            var pendingChar = session.CurrentCompletion.PendingChar;

            session.CurrentCompletion.ResetPending();
            if (pendingChar == null)
            {
                return(Task.CompletedTask);
            }

            return(typedCharEffects.ApplyTypedCharAsync(pendingChar.Value, session, sender, cancellationToken));
        }