pub fn lineDelta(source: []const u8, start: usize, end: usize) isize source: []const u8start: usizeend: usize154
155
156
157
158
159
160
161
162
163
164
165
166
167
168pub fn lineDelta(source: []const u8, start: usize, end: usize) isize {
var line: isize = 0;
if (end >= start) {
for (source[start..end]) |byte| switch (byte) {
'\n' => line += 1,
else => continue,
};
} else {
for (source[end..start]) |byte| switch (byte) {
'\n' => line -= 1,
else => continue,
};
}
return line;
}