コード例 #1
0
        private void UpdateForPasteWait(WpfTextChangedEventArgs e)
        {
            Debug.Assert(InPasteWait);

            var command = _margin.CommandLineTextBox.Text ?? "";

            if (e.Changes.Count == 1 && command.Length > 0)
            {
                var change = e.Changes.First();
                if (change.AddedLength == 1)
                {
                    // If we are in a paste wait context then attempt to complete it by passing on the
                    // typed char to _vimBuffer.  This will process it as the register
                    var c        = command[change.Offset];
                    var keyInput = KeyInputUtil.CharToKeyInput(c);
                    _vimBuffer.Process(keyInput);

                    // Now we need to update the command line.  During edits the controller is responsible
                    // for manually updating the command line state.  Also we have to keep the caret postion
                    // correct
                    var name    = RegisterName.OfChar(c);
                    var toPaste = name.IsSome() ? _vimBuffer.GetRegister(name.Value).StringValue : string.Empty;
                    EndPasteWait(toPaste);

                    return;
                }
            }

            // The buffer was in a paste wait but the UI isn't in sync for completing
            // the operation.  Just pass Escape down to the buffer so it will cancel out
            // of paste wait and go back to a known state
            _vimBuffer.Process(KeyInputUtil.EscapeKey);
        }
コード例 #2
0
ファイル: RegisterNameTest.cs プロジェクト: renjiec/VsVim
 public void AllChars1()
 {
     foreach (var cur in RegisterNameUtil.RegisterNameChars)
     {
         var res = RegisterName.OfChar(cur);
         Assert.True(res.IsSome());
     }
 }
コード例 #3
0
 public void Register()
 {
     _runner.Run(@"""a");
     Assert.True(_runner.HasRegisterName);
     Assert.Equal(RegisterName.OfChar('a').Value, _runner.RegisterName);
 }