Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
baderstine opened this issue May 14, 2024 · 5 comments
Closed

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

baderstine opened this issue May 14, 2024 · 5 comments
Labels
bug info needed Additional information requested—reprex, steps, open question, etc. source editor

Comments

@baderstine
Copy link

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")

  • [x ] I have read the guide for submitting good bug reports.
  • [x ] I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • [- ] If I am reporting an RStudio crash, I have included a diagnostics report.
  • [x ] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
@baderstine baderstine added bug new New incoming issues, ready for initial review. labels May 14, 2024
@ronblum
Copy link
Contributor

ronblum commented May 15, 2024

@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.

@ronblum ronblum added info needed Additional information requested—reprex, steps, open question, etc. source editor and removed new New incoming issues, ready for initial review. labels May 15, 2024
@baderstine
Copy link
Author

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

@ronblum
Copy link
Contributor

ronblum commented May 15, 2024

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

@baderstine
Copy link
Author

baderstine commented May 15, 2024

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
Copy link
Contributor

ronblum commented May 16, 2024

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

Also, TIL the acronym PEBCAK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug info needed Additional information requested—reprex, steps, open question, etc. source editor
Projects
None yet
Development

No branches or pull requests

2 participants