-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix find
routines' api to default to last=-1
#19761
Conversation
Ok, so this is a pale shadow of #18173. However, this PR is not an attempt of a complete overhaul of strutils API and focuses on immediate fix of a logical error and shouldn't break any reasonable code (besides likes of nimpylib). If the fixing of |
You can split it in two PRs with one focusing on fixing the doc. One PR brings one change. |
I could, but it would be a bit easier to know beforehand which one will be declined ;) |
sorry for nimpylib, will fix it for this PR today |
Done. Doc fixes separated to #19765 |
This changes the default for the `last` parameter of various `find` routines from `0` to `-1`. Previous default prevents limiting the search to the first character. This is a logic error, as full text search was performed for 2 *valid* values of `last`: `0` and `last.high()`. Adds an overload for `initSkipTable` which returns a newly initialized table. This encapsulates every single usage of a `var`-acting original func in this module.
Rebased on devel tip and squashed. |
|
ping @Araq any reason this can't be merged? |
Thanks for the merge! |
A changelog entry will be appreciated. |
This PR changes the default for the
last
parameter of variousfind
routines from0
to-1
. Previous default prevents limiting the search to the first character. This is a logic error introduced in #5196, as full text search was performed for 2 valid values oflast
:0
andlast.high()
. This fix also makes the api consistent withrfind
.Adds an overload for
initSkipTable
which returns a newly initialized table. This encapsulates every single usage of avar
-acting original func in this module.