Refactor out GetNextSelection; add command replace_next

#454 
I was mostly just using find next as a template, but you are totally right. I'll make that change.