summaryrefslogtreecommitdiff
path: root/src/config.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.zig')
-rw-r--r--src/config.zig24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/config.zig b/src/config.zig
index 4e46b1d8..4b47b188 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -111,6 +111,7 @@ pub const leader_path = paths: {
table.set(.DumpDir, null);
if (builtins.capabilities.window_opacity) table.set(.WindowOpacity, null);
if (builtins.capabilities.window_blur) table.set(.WindowBlur, null);
+ if (builtins.capabilities.ligatures) table.set(.Ligatures, null);
if (builtins.capabilities.panel_transitions) {
table.set(.PanelSlide, "as");
table.set(.PanelZoom, "az");
@@ -573,6 +574,9 @@ pub const Runtime = struct {
workspace_tag: bool = true,
column_tags: bool = true,
syntax_bold: bool = false,
+ /// A font's programming ligatures (`->`, `!=`) draw across their cells.
+ /// Only a shell that shapes text has the setting (`Capabilities.ligatures`).
+ ligatures: bool = true,
/// Builtins announce themselves on the message row.
verbose: bool = true,
/// A message falls into its row and dissolves out of it.
@@ -679,6 +683,8 @@ pub const Runtime = struct {
tagline_font_size: bool,
window_opacity: bool = false,
window_blur: bool = false,
+ /// The shell shapes text, so it can draw ligatures and stop drawing them.
+ ligatures: bool = false,
};
pub const Capability = std.meta.FieldEnum(Capabilities);
@@ -686,7 +692,7 @@ pub const Runtime = struct {
/// The message timings a setting word sets, each in milliseconds.
pub const MessageTime = enum { linger, fall, dissolve };
- pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, column_tags, syntax_bold, verbose, message_animation };
+ pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, column_tags, syntax_bold, verbose, message_animation, ligatures };
pub const Scene = std.meta.FieldEnum(layout.SceneEffect);
pub const Action = union(enum) {
@@ -737,6 +743,7 @@ pub const Runtime = struct {
.{ .word = "SyntaxBold", .action = .{ .toggle = .syntax_bold } },
.{ .word = "Verbose", .action = .{ .toggle = .verbose } },
.{ .word = "MessageAnimation", .action = .{ .toggle = .message_animation } },
+ .{ .word = "Ligatures", .action = .{ .toggle = .ligatures }, .availability = .ligatures },
.{ .word = "MessageLinger", .action = .{ .message_ms = .linger } },
.{ .word = "MessageFall", .action = .{ .message_ms = .fall } },
.{ .word = "MessageDissolve", .action = .{ .message_ms = .dissolve } },
@@ -796,6 +803,13 @@ pub const Runtime = struct {
@compileError("panel effects must use the panel-transition capability"),
.scene => if (setting.availability != .scene_shaders)
@compileError("scene effects must use the scene-shader capability"),
+ // A toggle is plain state any shell can hold, except one for
+ // what only some shells draw: that one exists where they do.
+ .toggle => |field| if (field == .ligatures) {
+ if (setting.availability != .ligatures)
+ @compileError("the ligatures toggle must use the ligatures capability");
+ } else if (setting.availability != null)
+ @compileError("unconditional toggles cannot carry a backend capability"),
else => if (setting.availability != null)
@compileError("unconditional settings cannot carry a backend capability"),
}
@@ -925,6 +939,10 @@ pub const Runtime = struct {
var wrote_transition = false;
for (settings) |setting| switch (setting.action) {
.toggle => |field| {
+ // A toggle for what this shell does not draw (Ligatures in a
+ // terminal, whose text its emulator draws) is no setting here:
+ // it is not a builtin, so the report does not list it either.
+ if (!setting.enabled(context.capabilities)) continue;
const value = switch (field) {
inline else => |f| @field(state, @tagName(f)),
};
@@ -1197,6 +1215,7 @@ pub const Runtime = struct {
.tagline_font_size = true,
.window_opacity = true,
.window_blur = true,
+ .ligatures = true,
},
.state = &state,
};
@@ -1232,6 +1251,7 @@ pub const Runtime = struct {
.syntax_bold => "SyntaxBold on\n",
.verbose => "Verbose off\n",
.message_animation => "MessageAnimation off\n",
+ .ligatures => "Ligatures off\n",
},
.shell => "Shell requested (new panes) fish\n",
.tagline_size => "TaglineSize 73\n",
@@ -1334,6 +1354,8 @@ pub const Runtime = struct {
try std.testing.expect(std.mem.indexOf(u8, defaults_report, "TaglineSize unsupported\n") != null);
try std.testing.expect(std.mem.indexOf(u8, defaults_report, "Look hover delay: off\n") != null);
try std.testing.expect(std.mem.indexOf(u8, defaults_report, "Native images: off\n") != null);
+ // A shell that does not shape text has no Ligatures setting to report.
+ try std.testing.expect(std.mem.indexOf(u8, defaults_report, "Ligatures") == null);
defaults_context.platform = "web";
defaults_context.capabilities.panel_transitions = false;