mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-30 04:39:03 +01:00
Fix string.insert with negative indices (#1598)
This commit is contained in:
parent
8fd0ffdb4b
commit
e1fcbaaf36
@ -1,3 +1,7 @@
|
|||||||
|
## 1.48.1
|
||||||
|
|
||||||
|
* Fix a bug in `string.insert` with certain negative indices.
|
||||||
|
|
||||||
## 1.48.0
|
## 1.48.0
|
||||||
|
|
||||||
### JS API
|
### JS API
|
||||||
|
@ -66,7 +66,7 @@ final _insert = _function("insert", r"$string, $insert, $index", (arguments) {
|
|||||||
if (indexInt < 0) {
|
if (indexInt < 0) {
|
||||||
// +1 because negative indexes start counting from -1 rather than 0, and
|
// +1 because negative indexes start counting from -1 rather than 0, and
|
||||||
// another +1 because we want to insert *after* that index.
|
// another +1 because we want to insert *after* that index.
|
||||||
indexInt = string.sassLength + indexInt + 2;
|
indexInt = math.max(string.sassLength + indexInt + 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var codepointIndex = _codepointForIndex(indexInt, string.sassLength);
|
var codepointIndex = _codepointForIndex(indexInt, string.sassLength);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: sass
|
name: sass
|
||||||
version: 1.48.0
|
version: 1.48.1-dev
|
||||||
description: A Sass implementation in Dart.
|
description: A Sass implementation in Dart.
|
||||||
homepage: https://github.com/sass/dart-sass
|
homepage: https://github.com/sass/dart-sass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user