Skip to content

Commit

Permalink
fix report messages
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Jan 26, 2024
1 parent 85d566a commit 9ee2d1b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/rivet/src/report/mod.ri
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func formatted_single_line(pos: token.Pos) {
start_column := utils.max(0, utils.min(pos.col, line.len));
end_column := utils.max(0, utils.min(pos.col + utils.max(0, pos.len), line.len));
mut sb := strings.Builder.new(line.len);
write_spaces(sb, start_column, line);
write_spaces(&mut sb, start_column, line);
sb.write(utils.bold(utils.blue("^")));
if pos.len > 1 {
sb.write(
Expand All @@ -151,7 +151,7 @@ func formatted_multi_line(pos: token.Pos) {
if line_nr + pos.line == pos.line {
mut sb := strings.Builder.new(line.len);
sb.write(utils.bold(utils.blue(" | ")));
write_spaces(sb, utils.max(0, utils.min(pos.col, line.len)), line);
write_spaces(&mut sb, utils.max(0, utils.min(pos.col, line.len)), line);
sb.write(utils.bold(utils.blue("/~~ from here")));
console.ewriteln(sb.to_string());
}
Expand All @@ -167,15 +167,15 @@ func formatted_multi_line(pos: token.Pos) {
if line_nr + pos.line == pos.end_line {
mut sb := strings.Builder.new(line.len);
sb.write(utils.bold(utils.blue(" | ")));
write_spaces(sb, utils.max(0, utils.min(pos.end_col, line.len)), line);
write_spaces(&mut sb, utils.max(0, utils.min(pos.end_col, line.len)), line);
sb.write(utils.bold(utils.blue("^~~ to here")));
console.ewriteln(sb.to_string());
}
}
}
}

func write_spaces(mut sb: strings.Builder, start_column: uint, line: string) {
func write_spaces(sb: &mut strings.Builder, start_column: uint, line: string) {
mut i: uint := 0;
while i < start_column {
b := line[i];
Expand Down

0 comments on commit 9ee2d1b

Please sign in to comment.