aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authoryujiri8 <yujiri@disroot.org>2022-10-20 10:57:57 +0000
committerGitHub <noreply@github.com>2022-10-20 13:57:57 +0300
commita99d465f624d9cdd82d270e03dd931c0539df8d7 (patch)
treeb4a9fdb2ffe99cd786fb5a9770e51830db8609b3 /src/Compilation.zig
parenta4eb221b9ef7dab8fa1c6cc07c7891e25d98d2b6 (diff)
downloadzig-a99d465f624d9cdd82d270e03dd931c0539df8d7.tar.gz
zig-a99d465f624d9cdd82d270e03dd931c0539df8d7.zip
Fix #12091: Error message with TERM=dumb is missing info
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 52acf1f031..fc71da56f3 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -429,25 +429,23 @@ pub const AllErrors = struct {
try stderr.print(" ({d} times)\n", .{src.count});
}
ttyconf.setColor(stderr, .Reset);
- if (ttyconf != .no_color) {
- if (src.source_line) |line| {
- for (line) |b| switch (b) {
- '\t' => try stderr.writeByte(' '),
- else => try stderr.writeByte(b),
- };
- try stderr.writeByte('\n');
- // TODO basic unicode code point monospace width
- const before_caret = src.span.main - src.span.start;
- // -1 since span.main includes the caret
- const after_caret = src.span.end - src.span.main -| 1;
- try stderr.writeByteNTimes(' ', src.column - before_caret);
- ttyconf.setColor(stderr, .Green);
- try stderr.writeByteNTimes('~', before_caret);
- try stderr.writeByte('^');
- try stderr.writeByteNTimes('~', after_caret);
- try stderr.writeByte('\n');
- ttyconf.setColor(stderr, .Reset);
- }
+ if (src.source_line) |line| {
+ for (line) |b| switch (b) {
+ '\t' => try stderr.writeByte(' '),
+ else => try stderr.writeByte(b),
+ };
+ try stderr.writeByte('\n');
+ // TODO basic unicode code point monospace width
+ const before_caret = src.span.main - src.span.start;
+ // -1 since span.main includes the caret
+ const after_caret = src.span.end - src.span.main -| 1;
+ try stderr.writeByteNTimes(' ', src.column - before_caret);
+ ttyconf.setColor(stderr, .Green);
+ try stderr.writeByteNTimes('~', before_caret);
+ try stderr.writeByte('^');
+ try stderr.writeByteNTimes('~', after_caret);
+ try stderr.writeByte('\n');
+ ttyconf.setColor(stderr, .Reset);
}
for (src.notes) |note| {
try note.renderToWriter(ttyconf, stderr, "note", .Cyan, indent);