terminal: don't build StringMap.searchIterator without regex support
parent
811f9f05d0
commit
4f974f4278
|
|
@ -23,7 +23,12 @@ pub fn init(
|
|||
deps.unicode_tables.addModuleImport(vt);
|
||||
vt_options.addOptions(b, vt, .{
|
||||
.artifact = .lib,
|
||||
|
||||
// We presently don't allow Oniguruma in our Zig module at all.
|
||||
// We should expose this as a build option in the future so we can
|
||||
// conditionally do this.
|
||||
.oniguruma = false,
|
||||
|
||||
.slow_runtime_safety = switch (cfg.optimize) {
|
||||
.Debug => true,
|
||||
.ReleaseSafe,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
const StringMap = @This();
|
||||
|
||||
const std = @import("std");
|
||||
const build_options = @import("terminal_options");
|
||||
const oni = @import("oniguruma");
|
||||
const point = @import("point.zig");
|
||||
const Selection = @import("Selection.zig");
|
||||
|
|
@ -19,7 +20,13 @@ pub fn deinit(self: StringMap, alloc: Allocator) void {
|
|||
}
|
||||
|
||||
/// Returns an iterator that yields the next match of the given regex.
|
||||
pub fn searchIterator(
|
||||
/// Requires Ghostty to be compiled with regex support.
|
||||
pub const searchIterator = if (build_options.oniguruma)
|
||||
searchIteratorOni
|
||||
else
|
||||
void;
|
||||
|
||||
fn searchIteratorOni(
|
||||
self: StringMap,
|
||||
regex: oni.Regex,
|
||||
) SearchIterator {
|
||||
|
|
@ -85,6 +92,8 @@ pub const Match = struct {
|
|||
};
|
||||
|
||||
test "StringMap searchIterator" {
|
||||
if (comptime !build_options.oniguruma) return error.SkipZigTest;
|
||||
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,12 @@ pub const Options = struct {
|
|||
artifact: Artifact = .ghostty,
|
||||
|
||||
/// Whether Oniguruma regex support is available. If this isn't
|
||||
/// available, some features will be disabled.
|
||||
/// available, some features will be disabled. This may be outdated,
|
||||
/// but the specific disabled features are:
|
||||
///
|
||||
/// - Kitty graphics protocol
|
||||
/// - Tmux control mode
|
||||
///
|
||||
oniguruma: bool = true,
|
||||
|
||||
/// True if we should enable the "slow" runtime safety checks. These
|
||||
|
|
|
|||
Loading…
Reference in New Issue