Skip to content

Commit 19fcb89

Browse files
committed
FIX: Properly handle series modification with /part and non-series values
resolves: Oldes/Rebol-issues#2683
1 parent cc1c088 commit 19fcb89

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.21.2
1+
3.21.3

make/rebol3.nest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ temp: %make/tmp/
1818
stack-size: 4194304 ;= 4MB (4 * 1024 * 1024)
1919
optimize: 2
2020

21-
version: 3.21.2
21+
version: 3.21.3
2222

2323
;flags: "-ggdb3"
2424
;define: DEBUG

src/core/f-modify.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
** REBOL [R3] Language Interpreter and Run-time Environment
44
**
55
** Copyright 2012 REBOL Technologies
6-
** Copyright 2012-2024 Rebol Open Source Contributors
6+
** Copyright 2012-2026 Rebol Open Source Contributors
77
** REBOL is a trademark of REBOL Technologies
88
**
99
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -186,7 +186,8 @@
186186
}
187187

188188
// For INSERT or APPEND with /PART use the dst_len not src_len:
189-
if (action != A_CHANGE && GET_FLAG(flags, AN_PART)) src_len = dst_len;
189+
if (action != A_CHANGE && GET_FLAG(flags, AN_PART) && src_len > dst_len)
190+
src_len = dst_len;
190191

191192
// If Source == Destination we need to prevent possible conflicts.
192193
// Clone the argument just to be safe.

src/tests/units/series-test.r3

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,10 @@ Rebol [
678678
--test-- "unicode string"
679679
;@@ https://github.com/Oldes/Rebol-issues/issues/2665
680680
--assert (replace/all "<á]] <é]]" "]]" #">") == "<á> <é>"
681+
682+
--test-- "issue-2683"
683+
;@@ https://github.com/Oldes/Rebol-issues/issues/2683
684+
--assert "YaYb" = replace/all "XXXaXXXb" "XXX" #"Y"
681685

682686
===end-group===
683687

@@ -754,6 +758,8 @@ Rebol [
754758
;@@ https://github.com/Oldes/Rebol-issues/issues/2683
755759
--assert "a" = append/part "" #"a" 10
756760
--assert "←" = append/part "" #"^(2190)" 10
761+
--assert "1" = append/part "" 1 10
762+
--assert "1.1.1" = append/part "" 1.1.1 10
757763
===end-group===
758764

759765
===start-group=== "APPEND ref!"

0 commit comments

Comments
 (0)