Skip to content

Commit

Permalink
Revert "Try to terminal translation on Windows"
Browse files Browse the repository at this point in the history
This reverts commit ca7593b.
  • Loading branch information
Beyley committed Jan 20, 2024
1 parent ca7593b commit 9b42930
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
14 changes: 1 addition & 13 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ const Api = @import("api");
const c = @import("c.zig").c;
const Config = @import("config.zig");

var terminal_translation = true;

pub const std_options = struct {
pub fn logFn(
comptime message_level: std.log.Level,
Expand All @@ -24,29 +22,20 @@ pub const std_options = struct {
.debug => "[1;35m",
.info => "[1;37m",
};

const level_txt = comptime message_level.asText();
const prefix2 = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
const stderr = std.io.getStdErr().writer();

std.debug.getStderrMutex().lock();
defer std.debug.getStderrMutex().unlock();

if (terminal_translation) {
nosuspend stderr.print("{c}" ++ color ++ level_txt ++ prefix2 ++ format ++ "{c}[0m\n", .{esc_code} ++ args ++ .{esc_code}) catch return;
} else {
nosuspend stderr.print(level_txt ++ prefix2 ++ format, args) catch return;
}
nosuspend stderr.print("{c}" ++ color ++ level_txt ++ prefix2 ++ format ++ "{c}[0m\n", .{esc_code} ++ args ++ .{esc_code}) catch return;
}

pub const log_level = if (builtin.mode == .Debug) .debug else .info;
};

pub fn main() !void {
if (builtin.os.tag == .windows) {
terminal_translation = try @import("windows.zig").enableTerminalSequences();
}

var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer if (gpa.deinit() == .leak) @panic("MEMORY LEAK");
const allocator = gpa.allocator();
Expand Down Expand Up @@ -395,7 +384,6 @@ pub fn runApp(allocator: std.mem.Allocator) !void {
}

if (config.close_upon_game_exit) {
std.log.info("User is not in a room, exiting...", .{});
return;
}

Expand Down
17 changes: 0 additions & 17 deletions src/windows.zig

This file was deleted.

0 comments on commit 9b42930

Please sign in to comment.