d51758b58acb

enable raw terminal mode on macos for the man and search TUIs: drop the linux-only termios guard (the ECHO/ICANON/ISIG/IEXTEN/ICRNL/IXON flags and V.MIN/V.TIME exist on every POSIX target Zig exposes, so the guard was a false assumption that left macos in cooked mode — echo on, line-buffered, requiring Enter); OPOST stays on so newline-to-CR-LF translation the renderers rely on is unchanged; bump v3.4.6

time
2026-07-01 16:44 UTC · 3 months ago
machine
koh2
agent
glm-5.2
session
macos tui raw mode
parent
309cf693ce0f
3 files VERSION+1 −1src/man.zig+13 −11src/search.zig+13 −13
VERSION+1 −1
@@ -1 +1 @@1-3.4.5\ No newline at end of file1+3.4.6\ No newline at end of file

view file

src/man.zig+13 −11
@@ -14,7 +14,6 @@1414 // Colors match the website palette: pink #AA6A52, gold #AD8A50, mint #708881,1515 // lavender #7A8162 on bg-surface #EEE6DB / bg-deep #CDBFAE.1616 const std = @import("std");17-const builtin = @import("builtin");1817 const output = @import("output.zig");1918 2019 const PINK = "\x1b[38;2;170;106;82m"; // --pink (#AA6A52)@@ -668,16 +667,19 @@668667 fn rawModeEnable(fd: std.posix.fd_t, saved: *std.posix.termios) !void {669668     var tio = try std.posix.tcgetattr(fd);670669     saved.* = tio;671-    if (comptime builtin.os.tag == .linux) {672-        tio.lflag.ECHO = false;673-        tio.lflag.ICANON = false;674-        tio.lflag.ISIG = false;675-        tio.lflag.IEXTEN = false;676-        tio.iflag.ICRNL = false;677-        tio.iflag.IXON = false;678-        tio.cc[@intFromEnum(std.posix.V.MIN)] = 1;679-        tio.cc[@intFromEnum(std.posix.V.TIME)] = 0;680-    }670+    // These flag names exist on every POSIX termios target Zig exposes671+    // (linux, macos, the *BSDs), so one body covers all of them — the old672+    // linux-only guard just left macos in cooked mode (echo on, line-buffered).673+    // OPOST is deliberately untouched: output keeps translating "\n" -> "\r\n",674+    // which the renderers rely on to return the cursor to column 0.675+    tio.lflag.ECHO = false;676+    tio.lflag.ICANON = false;677+    tio.lflag.ISIG = false;678+    tio.lflag.IEXTEN = false;679+    tio.iflag.ICRNL = false;680+    tio.iflag.IXON = false;681+    tio.cc[@intFromEnum(std.posix.V.MIN)] = 1;682+    tio.cc[@intFromEnum(std.posix.V.TIME)] = 0;681683     try std.posix.tcsetattr(fd, .FLUSH, tio);682684 }683685 

view file

src/search.zig+13 −13
@@ -1,7 +1,6 @@11 // search.zig — inline 18-line TUI widget, no alternate screen2-// Raw terminal mode for interactive key handling. Linux-only (NixOS target).2+// Raw terminal mode for interactive key handling (POSIX: linux + macos).33 const std = @import("std");4-const builtin = @import("builtin");54 const types = @import("types.zig");65 const output = @import("output.zig");76 const api = @import("api.zig");@@ -410,17 +409,18 @@410409 fn rawModeEnable(fd: std.posix.fd_t, saved: *std.posix.termios) !void {411410     var tio = try std.posix.tcgetattr(fd);412411     saved.* = tio;413-    if (comptime builtin.os.tag == .linux) {414-        tio.lflag.ECHO = false;415-        tio.lflag.ICANON = false;416-        tio.lflag.ISIG = false;417-        tio.lflag.IEXTEN = false;418-        tio.iflag.ICRNL = false;419-        tio.iflag.IXON = false;420-        tio.cc[@intFromEnum(std.posix.V.MIN)] = 1;421-        tio.cc[@intFromEnum(std.posix.V.TIME)] = 0;422-    }423-    // On non-Linux, terminal will not be in raw mode (TUI requires Linux)412+    // Same flag names exist on every POSIX termios target Zig exposes (linux,413+    // macos, the *BSDs), so one body covers all of them — the old linux-only414+    // guard left macos in cooked mode (echo on, line-buffered). OPOST is left415+    // on so output keeps translating "\n" -> "\r\n" (cursor to column 0).416+    tio.lflag.ECHO = false;417+    tio.lflag.ICANON = false;418+    tio.lflag.ISIG = false;419+    tio.lflag.IEXTEN = false;420+    tio.iflag.ICRNL = false;421+    tio.iflag.IXON = false;422+    tio.cc[@intFromEnum(std.posix.V.MIN)] = 1;423+    tio.cc[@intFromEnum(std.posix.V.TIME)] = 0;424424     try std.posix.tcsetattr(fd, .FLUSH, tio);425425 }426426 

view file