public void RaiseSearchResultMessages_NoMatchInPathBackward() { Create(""); _statusUtil.Setup(x => x.OnError(Resources.Common_SearchHitTopWithout("dog"))).Verifiable(); _operations.RaiseSearchResultMessage(SearchResult.NewNotFound( VimUtil.CreateSearchData("dog", SearchKind.Backward), true)); _statusUtil.Verify(); }
public void Put_BlockLineWise() { Create("dog", "cat"); _operations.Put(_textView.GetLine(1).Start, VimUtil.CreateStringDataBlock("a", "b"), OperationKind.LineWise); Assert.AreEqual("dog", _textView.GetLine(0).GetText()); Assert.AreEqual("a", _textView.GetLine(1).GetText()); Assert.AreEqual("b", _textView.GetLine(2).GetText()); Assert.AreEqual("cat", _textView.GetLine(3).GetText()); }
public void Add4() { Create(String.Empty); var command1 = VimUtil.CreateNormalBinding("foo", data => CommandResult.NewCompleted(ModeSwitch.NoSwitch)); var command2 = VimUtil.CreateNormalBinding("foo"); _runner.Add(command1); _runner.Add(command2); }
public void RaiseSearchResultMessages_NoMatch() { Create(""); _statusUtil.Setup(x => x.OnError(Resources.Common_PatternNotFound("dog"))).Verifiable(); _operations.RaiseSearchResultMessage(SearchResult.NewNotFound( VimUtil.CreateSearchData("dog"), false)); _statusUtil.Verify(); }
public void Reset1() { Create("hello world"); _runner.Add(VimUtil.CreateNormalBinding("abc", data => CommandResult.NewCompleted(ModeSwitch.NoSwitch))); Run("a"); Assert.IsTrue(_runner.IsWaitingForMoreInput); _runner.ResetState(); Assert.IsFalse(_runner.IsWaitingForMoreInput); }
public void KeyRemapMode_LongCommandPropagateMode() { Create("hello world"); _runner.Add(VimUtil.CreateComplexNormalBinding("a", x => true, KeyRemapMode.Language)); _runner.Run('a'); Assert.IsTrue(_runner.KeyRemapMode.IsSome(KeyRemapMode.Language)); _runner.Run('b'); Assert.IsTrue(_runner.KeyRemapMode.IsSome(KeyRemapMode.Language)); }
public void Run_NoMatchingCommand3() { Create("hello world"); _runner.Add(VimUtil.CreateNormalBinding("cot", data => CommandResult.NewCompleted(ModeSwitch.NoSwitch))); _runner.Add(VimUtil.CreateNormalBinding("cook", data => CommandResult.NewCompleted(ModeSwitch.NoSwitch))); Assert.IsTrue(_runner.Run('c').IsNeedMoreInput); Assert.IsTrue(_runner.Run('o').IsNeedMoreInput); Assert.IsTrue(_runner.Run('b').IsError); }
public void Run_Count4() { Create(string.Empty); var didRun = false; _runner.Add(VimUtil.CreateNormalBinding("a", () => { didRun = true; })); Assert.IsTrue(_runner.Run('0').IsError); Assert.IsFalse(didRun); }
public void Run_CommandMatch2() { Create(String.Empty); var count1 = 0; _runner.Add(VimUtil.CreateNormalBinding("a", data => { count1++; return(CommandResult.NewCompleted(ModeSwitch.NoSwitch)); })); Run("b"); Assert.AreEqual(0, count1); }
public void Remove1() { Create(String.Empty); var command1 = VimUtil.CreateNormalBinding("foo", data => CommandResult.NewCompleted(ModeSwitch.NoSwitch)); _runner.Add(command1); _runner.Remove(command1.KeyInputSet); Assert.AreEqual(0, _runner.Commands.Count()); }
public void Run_CommandMatch1() { Create(String.Empty); var count1 = 0; _runner.Add(VimUtil.CreateLegacyBinding("a", (count, reg) => { count1++; return(CommandResult.NewCompleted(ModeSwitch.NoSwitch)); })); Run("a"); Assert.AreEqual(1, count1); }
public void MoveCaretToMotionResult_CaretAfterLastLine() { Create("dog", "cat", "bear"); var data = VimUtil.CreateMotionResult( _textBuffer.GetLineRange(0).ExtentIncludingLineBreak, true, MotionKind.NewLineWise(CaretColumn.AfterLastLine)); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(_textBuffer.GetLine(1).Start, _textView.GetCaretPoint()); }
public void MoveCaretToMotionResult_ReverseLineWiseWithColumn() { Create(" dog", "cat", "bear"); var data = VimUtil.CreateMotionResult( span: _textView.GetLineRange(0, 1).ExtentIncludingLineBreak, isForward: false, motionKind: MotionKind.NewLineWise(CaretColumn.NewInLastLine(1))); _operations.MoveCaretToMotionResult(data); Assert.AreEqual(1, _textView.GetCaretPoint().Position); }