Compare commits
5 commits
32ed60bc64
...
d077f80d05
| Author | SHA1 | Date | |
|---|---|---|---|
| d077f80d05 | |||
| 74c18a55ef | |||
| 97558ad621 | |||
| cf496c881c | |||
| 4766673ead |
4 changed files with 63 additions and 66 deletions
103
build.zig
103
build.zig
|
|
@ -114,17 +114,21 @@ fn build_release(
|
||||||
all_targets: bool,
|
all_targets: bool,
|
||||||
test_filters: []const []const u8,
|
test_filters: []const []const u8,
|
||||||
) void {
|
) void {
|
||||||
const targets: []const std.Target.Query = if (all_targets) &.{
|
const targets: []const struct { std.Target.Query, Renderer } = if (all_targets) &.{
|
||||||
.{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .musl },
|
.{ .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .musl }, .terminal },
|
||||||
.{ .cpu_arch = .x86, .os_tag = .linux, .abi = .musl },
|
// .{ .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = null }, .gui },
|
||||||
.{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .musl },
|
.{ .{ .cpu_arch = .x86, .os_tag = .linux, .abi = .musl }, .terminal },
|
||||||
.{ .cpu_arch = .arm, .os_tag = .linux, .abi = .musleabihf },
|
.{ .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .musl }, .terminal },
|
||||||
.{ .cpu_arch = .x86_64, .os_tag = .macos },
|
// .{ .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = null }, .gui },
|
||||||
.{ .cpu_arch = .aarch64, .os_tag = .macos },
|
.{ .{ .cpu_arch = .arm, .os_tag = .linux, .abi = .musleabihf }, .terminal },
|
||||||
.{ .cpu_arch = .x86_64, .os_tag = .windows },
|
.{ .{ .cpu_arch = .x86_64, .os_tag = .macos }, .terminal },
|
||||||
.{ .cpu_arch = .aarch64, .os_tag = .windows },
|
.{ .{ .cpu_arch = .aarch64, .os_tag = .macos }, .terminal },
|
||||||
.{ .cpu_arch = .x86_64, .os_tag = .freebsd },
|
.{ .{ .cpu_arch = .x86_64, .os_tag = .windows }, .terminal },
|
||||||
.{ .cpu_arch = .aarch64, .os_tag = .freebsd },
|
.{ .{ .cpu_arch = .x86_64, .os_tag = .windows }, .d3d11 },
|
||||||
|
.{ .{ .cpu_arch = .aarch64, .os_tag = .windows }, .terminal },
|
||||||
|
.{ .{ .cpu_arch = .aarch64, .os_tag = .windows }, .d3d11 },
|
||||||
|
.{ .{ .cpu_arch = .x86_64, .os_tag = .freebsd }, .terminal },
|
||||||
|
.{ .{ .cpu_arch = .aarch64, .os_tag = .freebsd }, .terminal },
|
||||||
} else blk: {
|
} else blk: {
|
||||||
const maybe_triple = b.option(
|
const maybe_triple = b.option(
|
||||||
[]const u8,
|
[]const u8,
|
||||||
|
|
@ -133,8 +137,18 @@ fn build_release(
|
||||||
);
|
);
|
||||||
const triple = maybe_triple orelse {
|
const triple = maybe_triple orelse {
|
||||||
const native_target = b.resolveTargetQuery(.{}).result;
|
const native_target = b.resolveTargetQuery(.{}).result;
|
||||||
break :blk &.{
|
break :blk switch (native_target.os.tag) {
|
||||||
.{ .cpu_arch = native_target.cpu.arch, .os_tag = native_target.os.tag },
|
.linux => &.{
|
||||||
|
.{ .{ .cpu_arch = native_target.cpu.arch, .os_tag = native_target.os.tag, .abi = .musl }, .terminal },
|
||||||
|
// .{ .{ .cpu_arch = native_target.cpu.arch, .os_tag = native_target.os.tag, .abi = null }, .gui },
|
||||||
|
},
|
||||||
|
.windows => &.{
|
||||||
|
.{ .{ .cpu_arch = native_target.cpu.arch, .os_tag = native_target.os.tag }, .terminal },
|
||||||
|
.{ .{ .cpu_arch = native_target.cpu.arch, .os_tag = native_target.os.tag }, .d3d11 },
|
||||||
|
},
|
||||||
|
else => &.{
|
||||||
|
.{ .{ .cpu_arch = native_target.cpu.arch, .os_tag = native_target.os.tag }, .terminal },
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
const selected_target = std.Build.parseTargetQuery(.{
|
const selected_target = std.Build.parseTargetQuery(.{
|
||||||
|
|
@ -142,8 +156,18 @@ fn build_release(
|
||||||
}) catch |err| switch (err) {
|
}) catch |err| switch (err) {
|
||||||
error.ParseFailed => @panic("unknown target"),
|
error.ParseFailed => @panic("unknown target"),
|
||||||
};
|
};
|
||||||
break :blk &.{
|
break :blk switch (selected_target.os_tag.?) {
|
||||||
.{ .cpu_arch = selected_target.cpu_arch, .os_tag = selected_target.os_tag, .abi = selected_target.abi },
|
.linux => &.{
|
||||||
|
.{ .{ .cpu_arch = selected_target.cpu_arch, .os_tag = selected_target.os_tag, .abi = .musl }, .terminal },
|
||||||
|
// .{ .{ .cpu_arch = selected_target.cpu_arch, .os_tag = selected_target.os_tag, .abi = .gnu }, .gui },
|
||||||
|
},
|
||||||
|
.windows => &.{
|
||||||
|
.{ .{ .cpu_arch = selected_target.cpu_arch, .os_tag = selected_target.os_tag, .abi = selected_target.abi }, .terminal },
|
||||||
|
.{ .{ .cpu_arch = selected_target.cpu_arch, .os_tag = selected_target.os_tag, .abi = selected_target.abi }, .d3d11 },
|
||||||
|
},
|
||||||
|
else => &.{
|
||||||
|
.{ .{ .cpu_arch = selected_target.cpu_arch, .os_tag = selected_target.os_tag, .abi = selected_target.abi }, .terminal },
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
@ -155,8 +179,9 @@ fn build_release(
|
||||||
b.getInstallStep().dependOn(&b.addInstallFile(version_file, "version").step);
|
b.getInstallStep().dependOn(&b.addInstallFile(version_file, "version").step);
|
||||||
|
|
||||||
for (targets) |t| {
|
for (targets) |t| {
|
||||||
const target = b.resolveTargetQuery(t);
|
const renderer = t.@"1";
|
||||||
var triple = std.mem.splitScalar(u8, t.zigTriple(b.allocator) catch unreachable, '-');
|
const target = b.resolveTargetQuery(t.@"0");
|
||||||
|
var triple = std.mem.splitScalar(u8, t.@"0".zigTriple(b.allocator) catch unreachable, '-');
|
||||||
const arch = triple.next() orelse unreachable;
|
const arch = triple.next() orelse unreachable;
|
||||||
const os = triple.next() orelse unreachable;
|
const os = triple.next() orelse unreachable;
|
||||||
const target_path = std.mem.join(b.allocator, "-", &[_][]const u8{ os, arch }) catch unreachable;
|
const target_path = std.mem.join(b.allocator, "-", &[_][]const u8{ os, arch }) catch unreachable;
|
||||||
|
|
@ -176,7 +201,7 @@ fn build_release(
|
||||||
true, // strip release builds
|
true, // strip release builds
|
||||||
use_llvm,
|
use_llvm,
|
||||||
pie,
|
pie,
|
||||||
.terminal,
|
renderer,
|
||||||
version,
|
version,
|
||||||
test_filters,
|
test_filters,
|
||||||
);
|
);
|
||||||
|
|
@ -195,50 +220,10 @@ fn build_release(
|
||||||
false, // don't strip debug builds
|
false, // don't strip debug builds
|
||||||
use_llvm,
|
use_llvm,
|
||||||
pie,
|
pie,
|
||||||
.terminal,
|
renderer,
|
||||||
version,
|
version,
|
||||||
test_filters,
|
test_filters,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (t.os_tag == .windows) {
|
|
||||||
build_exe(
|
|
||||||
b,
|
|
||||||
run_step,
|
|
||||||
check_step,
|
|
||||||
test_step,
|
|
||||||
lint_step,
|
|
||||||
target,
|
|
||||||
optimize_release,
|
|
||||||
.{ .dest_dir = .{ .override = .{ .custom = target_path } } },
|
|
||||||
tracy_enabled,
|
|
||||||
use_tree_sitter,
|
|
||||||
true, // strip release builds
|
|
||||||
use_llvm,
|
|
||||||
pie,
|
|
||||||
.d3d11,
|
|
||||||
version,
|
|
||||||
test_filters,
|
|
||||||
);
|
|
||||||
|
|
||||||
build_exe(
|
|
||||||
b,
|
|
||||||
run_step,
|
|
||||||
check_step,
|
|
||||||
test_step,
|
|
||||||
lint_step,
|
|
||||||
target,
|
|
||||||
optimize_debug,
|
|
||||||
.{ .dest_dir = .{ .override = .{ .custom = target_path_debug } } },
|
|
||||||
tracy_enabled,
|
|
||||||
use_tree_sitter,
|
|
||||||
false, // don't strip debug builds
|
|
||||||
use_llvm,
|
|
||||||
pie,
|
|
||||||
.d3d11,
|
|
||||||
version,
|
|
||||||
test_filters,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -534,8 +534,14 @@ fn wioLoop() void {
|
||||||
const cp = pixelToCellPos(mouse_pos);
|
const cp = pixelToCellPos(mouse_pos);
|
||||||
tui_pid.send(.{ "RDR", "B", @as(u8, 1), btn_id, cp.col, cp.row, cp.xoff, cp.yoff }) catch {};
|
tui_pid.send(.{ "RDR", "B", @as(u8, 1), btn_id, cp.col, cp.row, cp.xoff, cp.yoff }) catch {};
|
||||||
},
|
},
|
||||||
.focused => window.enableTextInput(.{}),
|
.focused => {
|
||||||
.unfocused => window.disableTextInput(),
|
window.enableTextInput(.{});
|
||||||
|
tui_pid.send(.{"focus_in"}) catch {};
|
||||||
|
},
|
||||||
|
.unfocused => {
|
||||||
|
window.disableTextInput();
|
||||||
|
tui_pid.send(.{"focus_out"}) catch {};
|
||||||
|
},
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ pub fn run_cmd(self: *Self, ctx: command.Context) !void {
|
||||||
|
|
||||||
var argv_list: std.ArrayListUnmanaged([]const u8) = .empty;
|
var argv_list: std.ArrayListUnmanaged([]const u8) = .empty;
|
||||||
defer argv_list.deinit(self.allocator);
|
defer argv_list.deinit(self.allocator);
|
||||||
|
var have_cmd = false;
|
||||||
if (argv_msg) |msg| {
|
if (argv_msg) |msg| {
|
||||||
var iter = msg.buf;
|
var iter = msg.buf;
|
||||||
var len = try cbor.decodeArrayHeader(&iter);
|
var len = try cbor.decodeArrayHeader(&iter);
|
||||||
|
|
@ -94,6 +95,7 @@ pub fn run_cmd(self: *Self, ctx: command.Context) !void {
|
||||||
var arg: []const u8 = undefined;
|
var arg: []const u8 = undefined;
|
||||||
if (try cbor.matchValue(&iter, cbor.extract(&arg)))
|
if (try cbor.matchValue(&iter, cbor.extract(&arg)))
|
||||||
try argv_list.append(self.allocator, arg);
|
try argv_list.append(self.allocator, arg);
|
||||||
|
have_cmd = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const default_shell = if (builtin.os.tag == .windows)
|
const default_shell = if (builtin.os.tag == .windows)
|
||||||
|
|
@ -110,7 +112,7 @@ pub fn run_cmd(self: *Self, ctx: command.Context) !void {
|
||||||
const rows: u16 = @intCast(@max(24, self.plane.dim_y()));
|
const rows: u16 = @intCast(@max(24, self.plane.dim_y()));
|
||||||
|
|
||||||
if (global_vt) |*vt| {
|
if (global_vt) |*vt| {
|
||||||
if (!vt.process_exited) {
|
if (!vt.process_exited and have_cmd) {
|
||||||
var msg: std.Io.Writer.Allocating = .init(self.allocator);
|
var msg: std.Io.Writer.Allocating = .init(self.allocator);
|
||||||
defer msg.deinit();
|
defer msg.deinit();
|
||||||
try msg.writer.writeAll("terminal is already running '");
|
try msg.writer.writeAll("terminal is already running '");
|
||||||
|
|
@ -118,10 +120,9 @@ pub fn run_cmd(self: *Self, ctx: command.Context) !void {
|
||||||
try msg.writer.writeAll("'");
|
try msg.writer.writeAll("'");
|
||||||
return tp.exit(msg.written());
|
return tp.exit(msg.written());
|
||||||
}
|
}
|
||||||
vt.deinit(self.allocator);
|
} else {
|
||||||
global_vt = null;
|
try Vt.init(self.allocator, argv_list.items, env, rows, cols, on_exit);
|
||||||
}
|
}
|
||||||
try Vt.init(self.allocator, argv_list.items, env, rows, cols, on_exit);
|
|
||||||
self.vt = &global_vt.?;
|
self.vt = &global_vt.?;
|
||||||
|
|
||||||
if (self.last_cmd) |cmd| {
|
if (self.last_cmd) |cmd| {
|
||||||
|
|
|
||||||
|
|
@ -2174,7 +2174,12 @@ pub fn get_cursor_shape() renderer.CursorShape {
|
||||||
default_cursor
|
default_cursor
|
||||||
else
|
else
|
||||||
default_cursor;
|
default_cursor;
|
||||||
const shape = if (self.rdr_.vx.caps.multi_cursor and shape_ == .default) .beam_blink else shape_;
|
const shape = if (build_options.gui and shape_ == .default)
|
||||||
|
.beam
|
||||||
|
else if (self.rdr_.vx.caps.multi_cursor and shape_ == .default)
|
||||||
|
.beam_blink
|
||||||
|
else
|
||||||
|
shape_;
|
||||||
return switch (shape) {
|
return switch (shape) {
|
||||||
.default => .default,
|
.default => .default,
|
||||||
.block_blink => .block_blink,
|
.block_blink => .block_blink,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue