Browse Source

Revert "Merge pull request #3744 from Mango0x45/master"

This reverts commit 45044de0b756f9ab018979abd5350533334a54ac, reversing
changes made to 20c17ba6f971cf572da4fa5e9601e0df8d517112.
Jeroen van Rijn 1 year ago
parent
commit
ff4787070d
1 changed files with 7 additions and 23 deletions
  1. 7 23
      src/error.cpp

+ 7 - 23
src/error.cpp

@@ -296,7 +296,7 @@ gb_internal isize show_error_on_line(TokenPos const &pos, TokenPos end) {
 		terminal_set_colours(TerminalStyle_Bold, TerminalColour_White);
 		terminal_set_colours(TerminalStyle_Bold, TerminalColour_White);
 
 
 
 
-		i32 squiggle_extra = 0;
+		isize squiggle_extra = 0;
 
 
 		if (line_len > MAX_LINE_LENGTH_PADDED) {
 		if (line_len > MAX_LINE_LENGTH_PADDED) {
 			i32 left = MAX_TAB_WIDTH;
 			i32 left = MAX_TAB_WIDTH;
@@ -323,39 +323,23 @@ gb_internal isize show_error_on_line(TokenPos const &pos, TokenPos end) {
 		}
 		}
 		error_out("\n\t");
 		error_out("\n\t");
 
 
-		for (i32 rune_width, off = 0; off < offset; off += rune_width) {
-			i32 rune;
-			rune_width = cast(i32)utf8proc_iterate((u8 const *)line_text + off, line_len - off, &rune);
-			int w = utf8proc_charwidth(rune);
-			if (w > 0) {
-				error_out("%.*s", w, "    ");
-			}
+		for (i32 i = 0; i < offset; i++) {
+			error_out(" ");
 		}
 		}
 
 
 		terminal_set_colours(TerminalStyle_Bold, TerminalColour_Green);
 		terminal_set_colours(TerminalStyle_Bold, TerminalColour_Green);
 
 
 		error_out("^");
 		error_out("^");
 		if (end.file_id == pos.file_id) {
 		if (end.file_id == pos.file_id) {
-			i32 rune;
-
 			if (end.line > pos.line) {
 			if (end.line > pos.line) {
-				for (i32 rune, rune_width, off = offset; off < line_len; off += rune_width) {
-					rune_width = cast(i32)utf8proc_iterate((u8 const *)line_text + off, line_len - off, &rune);
-					int w = utf8proc_charwidth(rune);
-					if (w > 0) {
-						error_out("%.*s", w, "~~~~");
-					}
+				for (i32 i = offset; i < line_len; i++) {
+					error_out("~");
 				}
 				}
 			} else if (end.line == pos.line && end.column > pos.column) {
 			} else if (end.line == pos.line && end.column > pos.column) {
-				i32 columns = squiggle_extra;
-				for (i32 rune, rune_width, off = offset; off < offset + error_length - 1; off += rune_width) {
-					rune_width = cast(i32)utf8proc_iterate((u8 const *)line_text + off, line_len - off, &rune);
-					columns += utf8proc_charwidth(rune);
-				}
-				for (i32 i = 1; i < columns; i++) {
+				for (i32 i = 1; i < error_length-1+squiggle_extra; i++) {
 					error_out("~");
 					error_out("~");
 				}
 				}
-				if (columns > 0 && squiggle_extra == 0) {
+				if (error_length > 1 && squiggle_extra == 0) {
 					error_out("^");
 					error_out("^");
 				}
 				}
 			}
 			}