rstudio / rstudio

RStudio is an integrated development environment (IDE) for R
https://posit.co/products/open-source/rstudio/
Other
4.58k stars 1.08k forks source link

Find/Replace doesn't work with gsub statements #14704

Closed baderstine closed 2 weeks ago

baderstine commented 2 weeks ago

System details

RStudio Edition : Desktop
RStudio Version : 024.04.0 Build 735
OS Version      : Mac OS Sonoma 14.5 (23F79)
R Version       : R version 4.3.2 (2023-10-31)

Steps to reproduce the problem

In a .Rmd file containing a gsub function call.

e.g., gsub("blah","","sdfoiwje")

In "Source" view, Edit > Replace and Find Search for "," and attempt to replace it with ", " (i.e., add a space after the comma).

Describe the problem in detail

When you click replace, it doesn't actually change anything.

Describe the behavior you expected

I would expect this code to become: gsub("blah", "", "sdfoiwje")

ronblum commented 2 weeks ago

@baderstine Thank you for raising this! I can't reproduce this, though. Can you provide a minimal example of an R Markdown file that causes the failure? It'll help with trying to reproduce, in case I'm not using the code in a way that causes the problem.

baderstine commented 2 weeks ago

I just updated to RStudio version 2024.04.1 Build 748 and that seemed to fix it. Nevermind!

ronblum commented 2 weeks ago

@baderstine That's great! Though if the problem returns, please let us know.

baderstine commented 2 weeks ago

ah no, this is actually just me being an idiot (PEBCAK). If you try to use keyboard shortcuts for almost everything, you can get tripped up...

Steps to reproduce (On a Mac):

  1. Command + F
  2. search for ","
  3. tab to replace with ", "
  4. click "Next" button because you don't want to replace this result.
  5. hit "enter" to replace second result - in this case, enter is actually just "clicking" next again because that was the last button pressed.

What i should have done in step 5 is hit tab a few more times to move selection over to the "replace" button and then hit enter.

ronblum commented 2 weeks ago

@baderstine Ah! Honestly, I'm sure that I've done the same, too. 🙂

Also, TIL the acronym PEBCAK.