@@ -32,7 +32,7 @@ pub const Position = types.Position;
3232pub const Range = types .Range ;
3333
3434pub fn indexToPosition (text : []const u8 , index : usize , encoding : Encoding ) Position {
35- const last_line_start = if (std .mem .lastIndexOfScalar (u8 , text [0.. index ], '\n ' )) | line | line + 1 else 0 ;
35+ const last_line_start = if (std .mem .findScalarLast (u8 , text [0.. index ], '\n ' )) | line | line + 1 else 0 ;
3636 const line_count = std .mem .count (u8 , text [0.. last_line_start ], "\n " );
3737
3838 return .{
@@ -248,8 +248,8 @@ test rangeToSlice {
248248
249249pub fn lineLocAtIndex (text : []const u8 , index : usize ) Loc {
250250 return .{
251- .start = if (std .mem .lastIndexOfScalar (u8 , text [0.. index ], '\n ' )) | idx | idx + 1 else 0 ,
252- .end = std .mem .indexOfScalarPos (u8 , text , index , '\n ' ) orelse text .len ,
251+ .start = if (std .mem .findScalarLast (u8 , text [0.. index ], '\n ' )) | idx | idx + 1 else 0 ,
252+ .end = std .mem .findScalarPos (u8 , text , index , '\n ' ) orelse text .len ,
253253 };
254254}
255255
@@ -296,7 +296,7 @@ test lineSliceAtPosition {
296296
297297pub fn lineLocUntilIndex (text : []const u8 , index : usize ) Loc {
298298 return .{
299- .start = if (std .mem .lastIndexOfScalar (u8 , text [0.. index ], '\n ' )) | idx | idx + 1 else 0 ,
299+ .start = if (std .mem .findScalarLast (u8 , text [0.. index ], '\n ' )) | idx | idx + 1 else 0 ,
300300 .end = index ,
301301 };
302302}
0 commit comments