diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-24 13:01:25 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | d395739c8051e28726a4111eec1111a9c70567ec (patch) | |
| tree | 1e2ecebb1fa5cfc45009b286d1480a1779fc3898 /src/config.zig | |
| parent | 19a93afb5958b6a6548e1112813d4aa687a8976f (diff) | |
| download | pardes-d395739c8051e28726a4111eec1111a9c70567ec.tar.gz pardes-d395739c8051e28726a4111eec1111a9c70567ec.zip | |
Turn ligatures off with a Ligatures setting, in the shell that shapes text
The SDL shell shapes words with HarfBuzz, so a font's `->` and `!=` draw as
ligatures, and there was no way to have the plain glyphs back short of
changing font. `Ligatures` is a toggle, on by default; off, no cell goes to
the shaper and every cell draws its own glyph, exactly as a font without
ligatures does.
It exists only where it means something. A new `ligatures` capability, true
for the gui shell alone, gates it like Font and WindowOpacity are gated: it is
not a builtin elsewhere, has no leader path, and Config does not list it,
rather than print a row the TTY could never change. macOS draws CoreText
ligatures of its own, but nothing there reads the setting, so it stays off
there. The table check that kept every toggle unconditional now lets the
ligatures toggle, and only it, carry a capability, and requires that it
carry `ligatures`; every other setting's rule is as it was.
The gui keeps the setting beside its text caches, which were resolved under
it: when the core's value changes, the per-codepoint cells (which record
whether a cell is shaped) and the shaped words are dropped, and the frame the
toggle asked for draws every cell again. The atlas keeps its glyphs: plain
ones draw either way, and a ligature's strip is reused when it comes back.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Diffstat (limited to 'src/config.zig')
| -rw-r--r-- | src/config.zig | 24 |
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; |
