File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1016,14 +1016,21 @@ namespace Sass {
1016
1016
String_Constant_Ptr s = ARG (" $string" , String_Constant);
1017
1017
double start_at = ARG (" $start-at" , Number)->value ();
1018
1018
double end_at = ARG (" $end-at" , Number)->value ();
1019
+ String_Quoted_Ptr ss = SASS_MEMORY_CAST_PTR (String_Quoted, s);
1019
1020
1020
1021
std::string str = unquote (s->value ());
1021
1022
1022
1023
size_t size = utf8::distance (str.begin (), str.end ());
1023
1024
1024
- if (end_at < size * - 1.0 && size > 1 ) {
1025
- end_at = 0 ;
1025
+ if (! SASS_MEMORY_CAST (Number, env[ " $end-at " ]) ) {
1026
+ end_at = - 1 ;
1026
1027
}
1028
+
1029
+ if (end_at == 0 || (end_at + size) < 0 ) {
1030
+ if (ss && ss->quote_mark ()) newstr = quote (" " );
1031
+ return SASS_MEMORY_NEW (String_Quoted, pstate, newstr);
1032
+ }
1033
+
1027
1034
if (end_at < 0 ) {
1028
1035
end_at += size + 1 ;
1029
1036
if (end_at == 0 ) end_at = 1 ;
@@ -1043,7 +1050,7 @@ namespace Sass {
1043
1050
utf8::advance (end, end_at - start_at + 1 , str.end ());
1044
1051
newstr = std::string (start, end);
1045
1052
}
1046
- if (String_Quoted_Ptr ss = SASS_MEMORY_CAST_PTR (String_Quoted, s) ) {
1053
+ if (ss ) {
1047
1054
if (ss->quote_mark ()) newstr = quote (newstr);
1048
1055
}
1049
1056
}
You can’t perform that action at this time.
0 commit comments