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/PART not working after skipping the series #2324

Open
hostilefork opened this issue Oct 21, 2018 · 1 comment
Open

FIND/PART not working after skipping the series #2324

hostilefork opened this issue Oct 21, 2018 · 1 comment

Comments

@hostilefork
Copy link
Member

This bug existed in Red as well, but was patched. Copying from that issue:

>> str: "1.1.1"
== "1.1.1"
>> find/part str "1." 2
== "1.1.1"
>> str: skip str 2
== "1.1"
>> find/part str "1." 2
== none
>> find str "1."
== "1.1"
@hostilefork
Copy link
Member Author

This problem comes from a mistake in interpreting the return result of the helpers for decoding Partial()/Partial1(). They return a length in characters offset from the VAL_INDEX() of the series, not an absolute tail position:

https://github.com/rebol/rebol/blob/25033f897b2bd466068d7663563cd3ff64740b94/src/core/t-string.c#L516

To get the tail, the updated VAL_INDEX() (which may be modified during Partial()) should be added to the length returned.

This commit does a general cleanup to address this and other issues, and run more of the code through the same path...unifying Partial() and Partial1() and giving them better names. For instance, a Part_Len vs. Part_Tail specialization addresses the distinction for this issue:

metaeducation/ren-c@07e32b8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant