Refactor out GetNextSelection; add command replace_next

#454 
`replace_next` command doesn't receive any arguments.