diff --git a/jscomp/build_tests/super_errors/expected/highlighting5.re.expected b/jscomp/build_tests/super_errors/expected/highlighting5.re.expected index 7a0eb66385..3ecbffcd27 100644 --- a/jscomp/build_tests/super_errors/expected/highlighting5.re.expected +++ b/jscomp/build_tests/super_errors/expected/highlighting5.re.expected @@ -4,7 +4,7 @@ 1 │ /* overflows in the terminal */ 2 │ let a: int = "hellllllllllllllllllllllllllllllllllllllllllllllllllllllll - lllllllllllllllllllllllllll"; + │ lllllllllllllllllllllllllll"; 3 │ This has type: string diff --git a/jscomp/super_errors/super_code_frame.ml b/jscomp/super_errors/super_code_frame.ml index 4c41a7adb4..b6fbba43ff 100644 --- a/jscomp/super_errors/super_code_frame.ml +++ b/jscomp/super_errors/super_code_frame.ml @@ -238,20 +238,15 @@ let print ~is_warning ~src ~startPos ~endPos = Buffer.add_string buf (col NoColor "\n"); | Number line_number -> begin content |> List.iteri (fun i line -> - if i = 0 then begin - let gutter_color = - if i = 0 - && line_number >= highlight_line_start_line - && line_number <= highlight_line_end_line then - if is_warning then Warn else Err - else NoColor - in - draw_gutter gutter_color (string_of_int line_number); - end else begin - (* TODO: remove this branch after the next PR *) - let pad = String.make (max_line_digits_count + indent + 3) ' ' in - Buffer.add_string buf (col NoColor pad); - end; + let gutter_content = if i = 0 then string_of_int line_number else "" in + let gutter_color = + if i = 0 + && line_number >= highlight_line_start_line + && line_number <= highlight_line_end_line then + if is_warning then Warn else Err + else NoColor + in + draw_gutter gutter_color gutter_content; line.s |> String.iteri (fun ii ch -> let c = diff --git a/lib/4.06.1/unstable/js_compiler.ml b/lib/4.06.1/unstable/js_compiler.ml index 1917370acf..45c2d03788 100644 --- a/lib/4.06.1/unstable/js_compiler.ml +++ b/lib/4.06.1/unstable/js_compiler.ml @@ -407653,20 +407653,15 @@ let print ~is_warning ~src ~startPos ~endPos = Buffer.add_string buf (col NoColor "\n"); | Number line_number -> begin content |> List.iteri (fun i line -> - if i = 0 then begin - let gutter_color = - if i = 0 - && line_number >= highlight_line_start_line - && line_number <= highlight_line_end_line then - if is_warning then Warn else Err - else NoColor - in - draw_gutter gutter_color (string_of_int line_number); - end else begin - (* TODO: remove this branch after the next PR *) - let pad = String.make (max_line_digits_count + indent + 3) ' ' in - Buffer.add_string buf (col NoColor pad); - end; + let gutter_content = if i = 0 then string_of_int line_number else "" in + let gutter_color = + if i = 0 + && line_number >= highlight_line_start_line + && line_number <= highlight_line_end_line then + if is_warning then Warn else Err + else NoColor + in + draw_gutter gutter_color gutter_content; line.s |> String.iteri (fun ii ch -> let c = diff --git a/lib/4.06.1/whole_compiler.ml b/lib/4.06.1/whole_compiler.ml index 6aaedc785d..e85db4fc0a 100644 --- a/lib/4.06.1/whole_compiler.ml +++ b/lib/4.06.1/whole_compiler.ml @@ -433704,20 +433704,15 @@ let print ~is_warning ~src ~startPos ~endPos = Buffer.add_string buf (col NoColor "\n"); | Number line_number -> begin content |> List.iteri (fun i line -> - if i = 0 then begin - let gutter_color = - if i = 0 - && line_number >= highlight_line_start_line - && line_number <= highlight_line_end_line then - if is_warning then Warn else Err - else NoColor - in - draw_gutter gutter_color (string_of_int line_number); - end else begin - (* TODO: remove this branch after the next PR *) - let pad = String.make (max_line_digits_count + indent + 3) ' ' in - Buffer.add_string buf (col NoColor pad); - end; + let gutter_content = if i = 0 then string_of_int line_number else "" in + let gutter_color = + if i = 0 + && line_number >= highlight_line_start_line + && line_number <= highlight_line_end_line then + if is_warning then Warn else Err + else NoColor + in + draw_gutter gutter_color gutter_content; line.s |> String.iteri (fun ii ch -> let c =