Open your R sudio
Create two R script file. [file]>[new file] > [R script]
Open the one R script file by the new window (in the following picture's button).
Write any code in two R script files, i.e., one is opened by new window and the other is not opened by new window.
Please push [Control]+[shift]+[;] when the cursor is in the new window.
Then we will see that the new opened R script file's code is vanish, however, on the other hand, the code of R script file which is not opened by new windows remained or saved.
The above short cut [Control]+[shift]+[;] is very near for the short cut [Control]+[shift]+[L] for devtools::load_all(".") which are used when we develop package.
To avoid the code vanishing by such miss type, I hope R studio development team fix this issue.
My R studio version is 1.1.442
R version 3.5.1
I know someone cannot replicate this.