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()); }
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); }
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); }
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); }
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); }
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()); }
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()); }
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); }
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()); }
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()); }
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()); }
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); }