public void TypeForward1() { Create("the quick brown fox"); _textBuffer.Insert(0, "a"); Assert.IsNull(_lastChange); Assert.AreEqual(TextChange.NewInsert("a"), _tracker.CurrentChange.Value); }
public void SwitchMode1() { Create("the quick brown fox"); _textBuffer.Insert(1, "b"); _vimBuffer.RaiseSwitchedMode((IMode)null); Assert.AreEqual(TextChange.NewInsert("b"), _lastChange); }
public void InsertThenDeleteExact() { var textChange = TextChange.CreateReduced( TextChange.NewInsert("cat"), TextChange.NewDeleteLeft(3)); Assert.Equal("", textChange.AsInsert().Item); }
public void InsertThenDeleteMore() { var textChange = TextChange.CreateReduced( TextChange.NewInsert("cat"), TextChange.NewDeleteLeft(4)); Assert.Equal(1, textChange.AsDeleteLeft().Item); }
public void InsertText_CombinedInsert() { var textChange = TextChange.NewCombination( TextChange.NewInsert("hello "), TextChange.NewInsert("world")); Assert.Equal("hello world", textChange.InsertText.Value); }
public void InsertThenDeletePartial() { var textChange = TextChange.CreateReduced( TextChange.NewInsert("cat"), TextChange.NewDeleteLeft(2)); Assert.Equal("c", textChange.AsInsert().Text); }
public void TypeForward_AddMany1() { Create("the quick brown fox"); _textBuffer.Insert(0, "a"); _textBuffer.Insert(1, "bcd"); Assert.Null(_lastChange); Assert.Equal(TextChange.NewInsert("abcd"), _tracker.CurrentChange.Value); }
public void Delete3() { Create("the quick brown fox"); _textBuffer.Insert(0, "abc"); _textBuffer.Delete(new Span(2, 1)); Assert.IsNull(_lastChange); Assert.AreEqual(TextChange.NewInsert("ab"), _tracker.CurrentChange.Value); }
public void InsertText_SmallDeleteLeft() { var textChange = TextChange.NewCombination( TextChange.NewInsert("dogs"), TextChange.NewDeleteLeft(1)); Assert.Equal("dog", textChange.InsertText.Value); }
public void Special_SpaceToTab() { Create(" hello"); _operations.Setup(x => x.NormalizeBlanks(" ")).Returns("\t"); _operations.Setup(x => x.NormalizeBlanks("\t\t")).Returns("\t\t"); _textBuffer.Replace(new Span(0, 4), "\t\t"); Assert.Equal(TextChange.NewInsert("\t"), _tracker.CurrentChange.Value); }
public void InsertText_BigDeleteLeft() { var textChange = TextChange.NewCombination( TextChange.NewInsert("dogs"), TextChange.NewDeleteLeft(10)); Assert.True(textChange.InsertText.IsNone()); }
public void DoubleInsert() { var textChange = TextChange.CreateReduced( TextChange.NewInsert("a"), TextChange.NewInsert("b")); Assert.Equal("ab", textChange.AsInsert().Item); }
public void Special_SpaceToTab() { Create(" hello"); _operations.Setup(x => x.GetSpacesToPoint(It.IsAny <SnapshotPoint>())).Returns(0); _operations.Setup(x => x.NormalizeBlanks(" ", 0)).Returns("\t"); _operations.Setup(x => x.NormalizeBlanks("\t\t", 0)).Returns("\t\t"); _textBuffer.Replace(new Span(0, 4), "\t\t"); Assert.Equal(TextChange.NewInsert("\t"), _tracker.CurrentChange.Value); }
public void OnTextChange2() { CreateForText("hello"); var data = VimUtil.CreateCommandRunData(flags: CommandFlags.Repeatable); _runner.Raise(x => x.CommandRan += null, (object)null, data); _textChangeTracker.Raise(x => x.ChangeCompleted += null, (object)null, TextChange.NewInsert("foo")); Assert.IsTrue(_vimData.LastCommand.IsSome(x => x.IsTextChangeCommand)); }
public void Issue1108() { var textChange = TextChange.CreateReduced( TextChange.NewInsert("pr"), TextChange.NewCombination( TextChange.NewDeleteLeft(2), TextChange.NewInsert("protected"))); Assert.Equal("protected", textChange.AsInsert().Item); }
public void InsertAndDeleteLeft() { var textChange = TextChange.CreateReduced( TextChange.NewCombination( TextChange.NewInsert("cat"), TextChange.NewDeleteLeft(3)), TextChange.NewDeleteRight(3)); Assert.Equal(3, textChange.AsDeleteRight().Item); }
public void CaretMove1() { Create("the quick brown fox"); _textBuffer.Insert(0, "a"); _mouse.SetupGet(x => x.IsLeftButtonPressed).Returns(true).Verifiable(); _textCaret.Raise(x => x.PositionChanged += null, (CaretPositionChangedEventArgs)null); Assert.AreEqual(TextChange.NewInsert("a"), _lastChange); Assert.IsTrue(_tracker.CurrentChange.IsNone()); _factory.Verify(); }
public void ReplaceSimple() { Create("cat"); _insertUtilRaw.ApplyTextChange( TextChange.NewCombination( TextChange.NewDeleteRight(1), TextChange.NewInsert("b")), addNewLines: false); Assert.Equal("bat", _textBuffer.GetLine(0).GetText()); }
public void InsertThenDeletePastEndOfOriginalBuffer() { Create("cat"); _insertUtilRaw.ApplyTextChange( TextChange.NewCombination( TextChange.NewInsert("trucker"), TextChange.NewDeleteRight(3)), addNewLines: false); Assert.Equal("trucker", _textBuffer.GetLine(0).GetText()); Assert.Equal(7, _textView.GetCaretPoint().Position); }
public void LinkedWithTextChange_Simple() { CreateForText("hello"); var data = VimUtil.CreateCommandRunData(flags: CommandFlags.LinkedWithNextTextChange | CommandFlags.Repeatable); _runner.Raise(x => x.CommandRan += null, (object)null, data); _buffer.SetupGet(x => x.ModeKind).Returns(ModeKind.Insert); _textChangeTracker.Raise(x => x.ChangeCompleted += null, (object)null, TextChange.NewInsert("foo")); var last = _vimData.LastCommand; Assert.IsTrue(last.IsSome(x => x.IsLinkedCommand)); }
public void InsertText_Simple() { var textChange = TextChange.NewInsert("dog"); Assert.Equal("dog", textChange.InsertText.Value); }
public void OnTextChange_Standard() { CreateForText("hello"); _textChangeTracker.Raise(x => x.ChangeCompleted += null, (object)null, TextChange.NewInsert("foo")); Assert.IsTrue(_vimData.LastCommand.IsSome(x => x.IsTextChangeCommand)); }
public void LinkedWithNextChange_Simple() { Create("hello"); var runData1 = VimUtil.CreateCommandRunData(flags: CommandFlags.LinkedWithNextCommand | CommandFlags.Repeatable); var runData2 = VimUtil.CreateCommandRunData(flags: CommandFlags.Repeatable, command: Command.NewInsertCommand(InsertCommand.NewTextChange(TextChange.NewInsert("foo")))); _runner.Raise(x => x.CommandRan += null, (object)null, runData1); _runner.Raise(x => x.CommandRan += null, (object)null, runData2); var lastCommnad = _vimData.LastCommand; Assert.IsTrue(lastCommnad.IsSome(x => x.IsLinkedCommand)); }
public void RaiseChangeCompleted(string data) { RaiseChangeCompleted(TextChange.NewInsert(data)); }