Cancel selection after code chunk submission


#1

Hi,
First sorry if this is a duplicated post (I have searched but don’t seem to find an answer).
Often time I do selection on a piece of R code and then do ‘Ctrl + Enter’ to run. But when I want to continue editing, it often accidently deletes the block of code being selected. So I have to un-select first before typing. I just wonder if there is an option to un-select after submission to console.

Thanks,
Jason


#2

I don’t know that it’s an option, per se, but there are some keyboard shortcuts that could help (especially if you break your code up into sections):


#3

Thanks. I should have mentioned that I use emacs for editing (with default key-strokes). I can cancel the selection. My question is if there is way from RStudio to automatically ‘unselect’ after the code submission.
The closing thing I found so far is in this old thread: https://support.rstudio.com/hc/en-us/community/posts/200657063-accidental-deletion-in-source-code

I noticed that in the global option setting, there is an option for choosing whether one wants to focus console after submission, but I couldn’t find the cancel-selection after submission option.
Thanks


#4

No, this option doesn’t exist today. It’s a great idea, though! Would you be willing to file it as an enhancement request on our public issue tracker?


#5

Thanks. I have filed an issue as you suggested.