Skip to content

Commit cfbd485

Browse files
committed
Fix
1 parent 7eed080 commit cfbd485

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

src/elements/subword/braced_param/replace.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ pub fn set(obj: &mut BracedParam, core: &mut ShellCore) -> bool {
4949
if len == obj.text[start..].len() {
5050
obj.text = [&obj.text[..start], &string_to[0..] ].concat();
5151
return true;
52+
}else{
53+
ans += &ch.to_string();
54+
start += ch.len_utf8();
55+
continue;
5256
}
5357
} else if len != 0 && ! obj.all_replace {
5458
obj.text = [&obj.text[..start], &string_to[0..], &obj.text[start+len..] ].concat();

test/error

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../test/test_others.bash

test/ok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
./test_compound.bash
77
./test_others.bash
88
./test_job.bash
9+
../../../../test/test_others.bash

test/test_others.bash

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ res=$($com -c 'A="あいう いうえお"; echo ${A/%えお/えええeee}' )
195195
res=$($com -c 'A="あいうえお いうえお"; echo ${A/%えお/えええeee}' )
196196
[ "$res" = "あいうえお いうえええeee" ] || err $LINENO
197197

198+
res=$($com -c 'A="あいうえお"; echo ${A/%あ/えええeee}' )
199+
[ "$res" = "あいうえお" ] || err $LINENO
200+
198201
### IRREGULAR INPUT TEST ###
199202

200203
res=$($com <<< 'eeeeeecho hoge')

0 commit comments

Comments
 (0)