Refactor out GetNextSelection; add command replace_next

#454 
It'd be nice with a ```abcabcabc``` test also, just to make sure everything works in that instance also. Perhaps expand the replaceTest struct with a ```in string```?