예제 #1
0
 public void Put_BangShouldPutTextBefore()
 {
     Create("foo", "bar");
     UnnamedRegister.UpdateValue("hey", OperationKind.CharacterWise);
     ParseAndRun("put!");
     Assert.Equal("hey", _textBuffer.GetLine(0).GetText());
     Assert.Equal("foo", _textBuffer.GetLine(1).GetText());
 }
예제 #2
0
 public void PutOver_CharacterWise_UnnamedRegisters()
 {
     Create("dog", "cat");
     EnterMode(ModeKind.VisualCharacter, _textView.GetLineSpan(0, 0, 3));
     UnnamedRegister.UpdateValue("pig");
     _buffer.Process("\"cp");
     Assert.AreEqual("pig", _textView.GetLine(0).GetText());
     Assert.AreEqual("dog", UnnamedRegister.StringValue);
 }
예제 #3
0
 public void PutOver_Block_WithBlockAndCaretMove()
 {
     Create("dog", "cat");
     EnterBlock(_textView.GetBlockSpan(1, 1, 0, 2));
     UnnamedRegister.UpdateBlockValues("aa", "bb");
     _buffer.Process("gp");
     Assert.AreEqual("daag", _textView.GetLine(0).GetText());
     Assert.AreEqual("cbbt", _textView.GetLine(1).GetText());
     Assert.AreEqual(_textView.GetLine(1).Start.Add(3), _textView.GetCaretPoint());
 }
예제 #4
0
 public void PutOver_Block_WithCharacterWiseAndCaretMove()
 {
     Create("dog", "cat");
     EnterBlock(_textView.GetBlockSpan(1, 1, 0, 2));
     UnnamedRegister.UpdateValue("fish", OperationKind.CharacterWise);
     _buffer.Process("gp");
     Assert.AreEqual("dfishg", _textView.GetLine(0).GetText());
     Assert.AreEqual("ct", _textView.GetLine(1).GetText());
     Assert.AreEqual(5, _textView.GetCaretPoint().Position);
 }
예제 #5
0
 public void PutOver_CharacterWise_WithBlockAndCaretMove()
 {
     Create("dog", "cat");
     EnterMode(ModeKind.VisualCharacter, _textView.GetLineSpan(0, 1, 1));
     UnnamedRegister.UpdateBlockValues("aa", "bb");
     _buffer.Process("gp");
     Assert.AreEqual("daag", _textView.GetLine(0).GetText());
     Assert.AreEqual("cbbat", _textView.GetLine(1).GetText());
     Assert.AreEqual(_textView.GetLine(1).Start.Add(3), _textView.GetCaretPoint());
 }
예제 #6
0
 public void PutOver_CharacterWise_WithSingleCharacterWiseAndCaretMove()
 {
     Create("dog");
     EnterMode(ModeKind.VisualCharacter, _textView.GetLineSpan(0, 1, 1));
     UnnamedRegister.UpdateValue("cat", OperationKind.CharacterWise);
     _buffer.Process("gp");
     Assert.AreEqual("dcatg", _textView.GetLine(0).GetText());
     Assert.AreEqual(4, _textView.GetCaretPoint().Position);
     Assert.AreEqual("o", UnnamedRegister.StringValue);
 }
예제 #7
0
 public void PasteOverwritesFullLengthOfRegisterPastEndOfLine()
 {
     Create("123");
     UnnamedRegister.UpdateValue("hello");
     _vimBuffer.ProcessNotation("<S-R>");
     Assert.Equal(ModeKind.Replace, _vimBuffer.Mode.ModeKind);
     _vimBuffer.ProcessNotation("<C-r>\"");
     Assert.Equal("hello", _textBuffer.GetLine(0).GetText());
     Assert.Equal(5, _textView.GetCaretPoint().Position);
     Assert.Equal("hello", UnnamedRegister.StringValue);
 }
예제 #8
0
 public void AddLineBelow()
 {
     Create("cat", "dog", "fish");
     _textView.MoveCaretToLine(1);
     _vimBuffer.ProcessNotation("big <Esc>");
     UnnamedRegister.UpdateValue("tree" + Environment.NewLine, OperationKind.LineWise);
     _textView.MoveCaretToLine(2);
     _vimBuffer.ProcessNotation("p");
     _vimBuffer.ProcessNotation("'^");
     Assert.Equal(_textBuffer.GetLine(1).Start, _textView.GetCaretPoint());
 }
예제 #9
0
 public void PutOver_Block_WithLineWiseAndCaretMove()
 {
     Create("dog", "cat", "bear");
     EnterBlock(_textView.GetBlockSpan(1, 1, 0, 2));
     UnnamedRegister.UpdateValue("fish\n", OperationKind.LineWise);
     _buffer.Process("gp");
     Assert.AreEqual("dg", _textView.GetLine(0).GetText());
     Assert.AreEqual("ct", _textView.GetLine(1).GetText());
     Assert.AreEqual("fish", _textView.GetLine(2).GetText());
     Assert.AreEqual(_textView.GetLine(3).Start, _textView.GetCaretPoint());
 }
예제 #10
0
 public void PutOver_LineWise_WithLineWiseAndCaretMove()
 {
     Create("dog", "cat");
     EnterMode(ModeKind.VisualLine, _textView.GetLineRange(0).ExtentIncludingLineBreak);
     UnnamedRegister.UpdateValue("fish\n", OperationKind.LineWise);
     _buffer.Process("gp");
     Assert.AreEqual("fish", _textView.GetLine(0).GetText());
     Assert.AreEqual("cat", _textView.GetLine(1).GetText());
     Assert.AreEqual(_textView.GetLine(1).Start, _textView.GetCaretPoint());
     Assert.AreEqual("dog\r\n", UnnamedRegister.StringValue);
 }
예제 #11
0
 public void PutOver_CharacterWise_WithLineWiseAndCaretMove()
 {
     Create("dog");
     EnterMode(ModeKind.VisualCharacter, _textView.GetLineSpan(0, 1, 1));
     UnnamedRegister.UpdateValue("cat\n", OperationKind.LineWise);
     _buffer.Process("gp");
     Assert.AreEqual("d", _textView.GetLine(0).GetText());
     Assert.AreEqual("cat", _textView.GetLine(1).GetText());
     Assert.AreEqual("g", _textView.GetLine(2).GetText());
     Assert.AreEqual(_textView.GetLine(2).Start, _textView.GetCaretPoint());
 }
예제 #12
0
 public void Global_Put()
 {
     Create("cat", "dog", "fash");
     UnnamedRegister.UpdateValue("bat");
     ParseAndRun("g,a,put");
     Assert.Equal("cat", _textBuffer.GetLine(0).GetText());
     Assert.Equal("bat", _textBuffer.GetLine(1).GetText());
     Assert.Equal("dog", _textBuffer.GetLine(2).GetText());
     Assert.Equal("fash", _textBuffer.GetLine(3).GetText());
     Assert.Equal("bat", _textBuffer.GetLine(4).GetText());
     Assert.Equal(_textView.GetPointInLine(4, 0), _textView.GetCaretPoint());
 }
예제 #13
0
 public void EditTheEditLine()
 {
     Create("cat", "dog", "fish");
     _textView.MoveCaretToLine(1);
     _vimBuffer.ProcessNotation("big <Esc>");
     UnnamedRegister.UpdateValue("cat ", OperationKind.CharacterWise);
     _textView.MoveCaretToLine(1);
     _vimBuffer.ProcessNotation("P");
     _textView.MoveCaretToLine(2);
     _vimBuffer.ProcessNotation("`^");
     Assert.Equal(_textBuffer.GetPointInLine(1, 4), _textView.GetCaretPoint());
 }
예제 #14
0
 public void PutAfterWithIndent_VisualLine()
 {
     Create("  dog", "  cat", "bear");
     EnterMode(ModeKind.VisualLine, _textView.GetLineRange(0).ExtentIncludingLineBreak);
     UnnamedRegister.UpdateValue("bear", OperationKind.LineWise);
     _buffer.Process("]p");
     Assert.AreEqual("  dog", _textView.GetLine(0).GetText());
     Assert.AreEqual("  bear", _textView.GetLine(1).GetText());
     Assert.AreEqual(_textView.GetPointInLine(1, 2), _textView.GetCaretPoint());
     Assert.AreEqual(_textView.GetLineRange(0, 1).ExtentIncludingLineBreak, _textView.GetSelectionSpan());
     Assert.AreEqual(ModeKind.VisualLine, _buffer.ModeKind);
 }
예제 #15
0
 public void PutOver_LineWise_WithBlock()
 {
     Create("dog", "cat");
     EnterMode(ModeKind.VisualLine, _textView.GetLineRange(0).ExtentIncludingLineBreak);
     UnnamedRegister.UpdateBlockValues("aa", "bb");
     _buffer.Process("p");
     Assert.AreEqual("aa", _textView.GetLine(0).GetText());
     Assert.AreEqual("bb", _textView.GetLine(1).GetText());
     Assert.AreEqual("cat", _textView.GetLine(2).GetText());
     Assert.AreEqual(0, _textView.GetCaretPoint().Position);
     Assert.AreEqual("dog\r\n", UnnamedRegister.StringValue);
 }