Fix mark position when r command exits
Test cases for s,S
Test for x,X