Skip to content

Commit

Permalink
str-slice() $end-at should default to -1 if omitted
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyfer committed Jan 7, 2015
1 parent 0b59526 commit a191d66
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,10 @@ namespace Sass {

// `str-slice` should always return an empty string when $end-at == 0
// `normalize_index` normalizes 1 -> 0 so we need to check the original value
if(start == end && m->value() > 0) {
if(m->value() == 0) {
if(!quotemark) return new (ctx.mem) Null(pstate);
newstr = "";
} else if(start == end && m->value() > 0) {
newstr = str.substr(start, 1);
} else if(end > start) {
newstr = str.substr(start, end - start + UTF_8::code_point_size_at_offset(str, end));
Expand Down

0 comments on commit a191d66

Please sign in to comment.