RStudio tries to open Rmd file in wrong window

This bug has been around for a while, but I finally got sufficiently tired of it to try reporting it.

To reproduce the bug on Windows:

  1. Load any Rmd file into RStudio.
  2. Knit to an HTML file, and leave the viewer window open.
  3. Now navigate to a Windows file explorer window and double-click on a different Rmd file.

What happens? The viewer window gets the focus and pops to the front of the screen (if it wasn't already there). The Rmd file does not appear in a new tab in the actual IDE window.

What should happen? The viewer should stay out of the way, and the IDE should load the Rmd file in a new tab.

You can replace step 2 above with
2A: Generate a plot, and select zoom from the plot panel. Leave the zoom window open.
and you can see the same bug.

Thanks for reporting this. Do you mind opening an issue at GitHub - rstudio/rstudio: RStudio is an integrated development environment (IDE) for R with all the details?