Fix inserting before/after a range into the string

This commit is contained in:
Eugen Wissner 2018-02-25 12:53:42 +01:00
parent d30de300d6
commit 5ae20512af

View File

@ -1564,10 +1564,12 @@ struct String
}
do
{
auto oldLen = this.data + length;
const oldLength = length;
const rangeEnd = r.end - this.data;
const inserted = insertBack(el);
bringToFront(ByCodeUnit!char(this, r.end, oldLen),
ByCodeUnit!char(this, oldLen, this.data + length));
auto containerEnd = this.data + oldLength;
bringToFront(ByCodeUnit!char(this, this.data + rangeEnd, containerEnd),
ByCodeUnit!char(this, containerEnd, this.data + length));
return inserted;
}