Skip to content

Conversation

byroot
Copy link
Member

@byroot byroot commented Aug 3, 2025

Otherwise characters with regexp meaning like . won't behave as expected.

Actually . when inside [] doesn't have a special meaning, however \ and a few other break the search.

Otherwise characters with regexp meaning like `.` won't behave as
expected.
@byroot byroot temporarily deployed to fork-preview-protection August 3, 2025 14:39 — with GitHub Actions Inactive
@matzbot
Copy link
Collaborator

matzbot commented Aug 4, 2025

🚀 Preview deployment available at: https://6621dea1.rdoc-6cd.pages.dev (commit: 481b5d5)

@st0012
Copy link
Member

st0012 commented Aug 4, 2025

Sorry can you give me an example of the issue that you're trying to fix?

@byroot
Copy link
Member Author

byroot commented Aug 4, 2025

For now this doesn't fix much of anything, because nothing really match these special characters.

But my initial plan was to allow to search by fully qualified name, e.g. Array#map, or Array.new, and this small bug was in the way. I didn't get around to implement the feature I wanted (yet?) because the JSON blob with the data that is being searched doesn't have fully qualified names. So it's much more work.

Hence I figured I'd just submit that small fix independently.

If you want to check it works, go on the current version of RDoc, and search for \:

Uncaught SyntaxError: unterminated character class
    buildRegexps https://ruby.github.io/rdoc/js/searcher.js:61
    buildRegexps https://ruby.github.io/rdoc/js/searcher.js:60
    find https://ruby.github.io/rdoc/js/searcher.js:17
    search https://ruby.github.io/rdoc/js/search.js:54
    observer https://ruby.github.io/rdoc/js/search.js:23
2 [searcher.js:61:14](https://ruby.github.io/rdoc/js/searcher.js)

On this branch, it doesn't crash.

@st0012 st0012 added the bug label Aug 4, 2025
Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok I can verify that it avoids the JS error. Thanks!

@st0012 st0012 merged commit 171120d into ruby:master Aug 4, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants