ensure entire selection lies in R/C++ mode