manager.selectPreviousMatch();
assertSelection(lineEleven, 8, 15);
}
public void testReplaceMatch() {
LineInfo lineThree = SearchTestsUtil.gotoLineInfo(document, 3);
LineInfo lineSix = SearchTestsUtil.gotoLineInfo(document, 6);
LineInfo lineEight = SearchTestsUtil.gotoLineInfo(document, 8);
SearchMatchManager manager = createMatchManager(document, model);
manager.setSearchPattern(RegExp.compile("doug", "gi"));
// NOTE! Since this a not an editor mutator, selection won't be replaced
// so you will get newtextoldtext when calling replace.
manager.addMatches(lineSix, 1);
assertTrue(manager.replaceMatch("boug"));
assertEquals("boug", document.getText(lineSix.line(), 41, 4));
document.deleteText(lineSix.line(), 45, 4);
assertTrue(manager.replaceMatch("soug"));
assertEquals("soug", document.getText(lineEight.line(), 0, 4));
model.setSelection(lineThree, 0, lineThree, 0);
manager.setSearchPattern(RegExp.compile("catwoman"));
manager.addMatches(lineThree, 1);
assertTrue(manager.replaceMatch("dogwoman"));