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 #2325

Closed
Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Closed

FIND/PART not working after skipping the series #2325

Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Labels
Oldes.resolved Bugs/wishes with Oldes' fixes/features Ren.resolved Test.written Type.bug

Comments

@Siskin-Bot
Copy link
Collaborator

Submitted by: Hostilefork

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"

Imported from: metaeducation#2324

Comments:


Hostilefork added Type.bug and Ren.important on Oct 21, 2018


Hostilefork commented on Oct 21, 2018:

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


Hostilefork added the Ren.resolved on Oct 21, 2018


Oldes added a commit to Oldes/Rebol3 that referenced this issue on Oct 23, 2018:
FIX: FIND/PART not working after skipping the series


@Siskin-Bot Siskin-Bot added Oldes.resolved Bugs/wishes with Oldes' fixes/features Ren.resolved Type.bug labels Feb 15, 2020
@Oldes Oldes closed this as completed Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Oldes.resolved Bugs/wishes with Oldes' fixes/features Ren.resolved Test.written Type.bug
Projects
None yet
Development

No branches or pull requests

2 participants