示例#1
0
 public void InputLast_OnlyOneMatch()
 {
     Create("cat", "dog", "rabbit", "tree");
     _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird"));
     Assert.True(_mode.Process('l').IsSwitchMode(ModeKind.Normal));
     Assert.Equal("bird", _textBuffer.GetLine(0).GetText());
 }
示例#2
0
 public void InputYes_OnlyOneMatchInBuffer()
 {
     Create("cat", "dog", "rabbit", "tree");
     _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird"));
     _mode.Process('y');
     Assert.Equal("bird", _textBuffer.GetLine(0).GetText());
 }
示例#3
0
 public void CurrentMatchChanged_OnEnter()
 {
     Create("cat", "cat", "rabbit", "tree");
     VeriyCurrentMatchChanged(
         () => _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent)),
         _textBuffer.GetLine(0).Extent);
 }
示例#4
0
 public void InputYes_TwoMatchesOnLineButNotReplaceAll()
 {
     Create("cat cat", "dog", "rabbit", "tree");
     _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetSpan(0, 3), "cat", "bird", range: _textBuffer.GetLineRange(0)));
     Assert.True(_mode.Process('y').IsSwitchMode(ModeKind.Normal));
     Assert.Equal("bird cat", _textBuffer.GetLine(0).GetText());
 }
示例#5
0
 public void CurrentMatchChanged_OnYesGoesToNext()
 {
     Create("cat", "cat", "rabbit", "tree");
     _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird"));
     VeriyCurrentMatchChanged(
         () => { _mode.Process('y'); },
         () => _textBuffer.GetLine(1).Extent);
 }
示例#6
0
 public void CurrentMatchChanged_OnYesEnds()
 {
     Create("cat", "dog", "rabbit", "tree");
     _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird"));
     VeriyCurrentMatchChanged(
         () => { _mode.Process('y'); },
         expected: null);
 }
示例#7
0
 public void InputAll_TwoMatchesInRange()
 {
     Create("cat", "cat", "rabbit", "tree");
     _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird"));
     Assert.True(_mode.Process('a').IsSwitchMode(ModeKind.Normal));
     Assert.Equal("bird", _textBuffer.GetLine(0).GetText());
     Assert.Equal("bird", _textBuffer.GetLine(1).GetText());
 }
示例#8
0
 public void InputYes_TwoMatchesInRange()
 {
     Create("cat", "cat", "rabbit", "tree");
     _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird", SubstituteFlags.ReplaceAll, range: _textBuffer.GetLineRange(0, 1)));
     Assert.True(_mode.Process('y').IsHandledNoSwitch());
     Assert.Equal("bird", _textBuffer.GetLine(0).GetText());
     Assert.Equal(_textBuffer.GetLine(1).Extent, _mode.CurrentMatch.Value);
 }
示例#9
0
 public void InputYes_TwoMatchesOnLineAndReplaceAll()
 {
     Create("cat cat", "dog", "rabbit", "tree");
     _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetSpan(0, 3), "cat", "bird", SubstituteFlags.ReplaceAll, range: _textBuffer.GetLineRange(0)));
     _operations.Setup(x => x.MoveCaretToPointAndEnsureVisible(_textBuffer.GetPoint(5))).Verifiable();
     Assert.True(_mode.Process('y').IsHandledNoSwitch());
     Assert.Equal("bird cat", _textBuffer.GetLine(0).GetText());
     Assert.Equal(_textBuffer.GetSpan(5, 3), _mode.CurrentMatch.Value);
     _factory.Verify();
 }
示例#10
0
 public void OnEnter_StandardArgument()
 {
     Create("cat", "dog", "rabbit", "tree");
     _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "a", "b"));
     Assert.Equal(_textBuffer.GetLine(0).Extent, _mode.CurrentMatch.Value);
 }
示例#11
0
 public void InputQuit_InMatch()
 {
     Create("cat", "dog", "rabbit", "tree");
     _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird"));
     Assert.True(_mode.Process('q').IsSwitchMode(ModeKind.Normal));
 }