summaryrefslogtreecommitdiff
path: root/src/config.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.zig')
-rw-r--r--src/config.zig57
1 files changed, 10 insertions, 47 deletions
diff --git a/src/config.zig b/src/config.zig
index 6f45adba..3e05d7e1 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -114,7 +114,6 @@ pub const leader_path = paths: {
.Search = null,
.Panes = null,
.More = null,
- .JumpScope = null,
.Debug = "td",
.Msg = null,
.Verbose = null,
@@ -149,10 +148,8 @@ pub const leader_path = paths: {
table.set(.MessageLinger, null);
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.pixels) table.set(.CursorBlink, null);
table.set(.JumpTrail, null);
- table.set(.ProgramEsc, null);
if (builtins.capabilities.pixels) table.set(.GripWidth, null);
table.set(.InactiveDim, null);
if (builtins.capabilities.pixels) table.set(.Pet, null);
@@ -259,8 +256,8 @@ pub const jump_keys = [_]struct { chord: Chord, cmd: Builtin }{
/// Shift-Esc: the Esc nothing swallows. In every mode and pane it does what
/// Esc does from normal mode, back to the previous pane (Last); in a raw
-/// terminal plain Esc does it and Shift-Esc is the program's Esc, unless
-/// ProgramEsc is on. Ctrl-b alone toggles raw.
+/// terminal plain Esc does it and Shift-Esc is the program's Esc. Ctrl-b
+/// alone toggles raw.
pub const back_out: []const Chord = &.{.{ .cp = Key.escape, .shift = true }};
pub const tty_toggle_default: u21 = 'b';
@@ -701,16 +698,12 @@ pub const Runtime = struct {
/// A jump of the cursor leaves a short trail that fades: a setting
/// alone, each frontend draws it (jump_trail.zig).
jump_trail: bool = false,
- /// In a raw terminal, Esc goes to the program and Shift-Esc backs out
- /// (off, the default: Esc backs out and Shift-Esc is the program's).
- program_esc: bool = false,
/// How long a message stays after the key or click that dismisses it.
message_linger_ms: u16 = 800,
/// Where Dump writes and a relative Restore looks; empty is the default
/// ($XDG_DATA_HOME/pardes, else ~/.local/share/pardes).
dump_dir: Text(limits.host_path_cap) = .{},
window_opacity: u8 = 100,
- window_blur: u8 = 0,
window_opacity_pending: bool = true,
/// The window's companion in the workspace tag's blank space
/// (gui/pet.zig), or none: a setting alone, the window moves it.
@@ -734,18 +727,13 @@ pub const Runtime = struct {
tagline_percent: u8 = 100,
} = .{},
- /// What Back and Forward keep to (Jump.jumpBy): `file`, the places in
- /// the focused pane's file first, other files only once those run out
- /// that way; `all`, every place in the order it was jumped to.
- jump_scope: JumpScope = .file,
/// acme's Tab: a tab's width in cells, in every pane (config.tab_now
/// is what the drawing and the column arithmetic read).
tab: u16 = tab_width,
callstack_depth: u8 = @import("lsp/lsp.zig").callstack_default_depth,
- pub const JumpScope = enum { file, all };
/// A setting that is one of a few words, each an enum field of Runtime.
- pub const Choice = enum { jump_scope, pet };
+ pub const Choice = enum { pet };
pub const Pet = enum { off, cat, frog };
pub const tagline_percent_min: u8 = 1;
@@ -807,7 +795,6 @@ pub const Runtime = struct {
font_picker: bool,
tagline_font_size: bool,
window_opacity: bool = false,
- window_blur: bool = false,
/// The shell draws its own pixels (the SDL window): the grip at
/// GripWidth, its own cursor blink, the Pet.
pixels: bool = false,
@@ -815,7 +802,7 @@ pub const Runtime = struct {
pub const Capability = std.meta.FieldEnum(Capabilities);
- pub const Toggle = enum { wrap, debug, verbose, cursor_blink, jump_trail, program_esc };
+ pub const Toggle = enum { wrap, debug, verbose, cursor_blink, jump_trail };
pub const Action = union(enum) {
toggle: Toggle,
@@ -824,7 +811,6 @@ pub const Runtime = struct {
font,
tagline_size,
window_opacity,
- window_blur,
message_linger,
dump_dir,
/// A percentage, 0 through 100.
@@ -856,7 +842,6 @@ pub const Runtime = struct {
return switch (action) {
.font, .tagline_size => .font_picker,
.window_opacity => .window_opacity,
- .window_blur => .window_blur,
.grip_width => .pixels,
.toggle => |field| switch (field) {
.cursor_blink => .pixels,
@@ -874,7 +859,6 @@ pub const Runtime = struct {
.{ .word = "Verbose", .action = .{ .toggle = .verbose }, .doc = "A builtin says its own name on the message row as it runs, on or off." },
.{ .word = "CursorBlink", .action = .{ .toggle = .cursor_blink }, .doc = "The cursor blinks, solid while typing, on or off." },
.{ .word = "JumpTrail", .action = .{ .toggle = .jump_trail }, .doc = "A jump of the cursor leaves a short trail that fades, on or off." },
- .{ .word = "ProgramEsc", .action = .{ .toggle = .program_esc }, .doc = "In a raw terminal, Esc goes to the program and Shift-Esc backs out, on; off (the default) swaps them." },
.{ .word = "GripWidth", .action = .grip_width, .doc = "The grip and scrollbar width, as a percent of the theme's rail." },
.{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." },
.{ .word = "Pet", .action = .{ .choice = .pet }, .doc = "The window's companion in the workspace tag's blank space: off, cat or frog." },
@@ -885,8 +869,6 @@ pub const Runtime = struct {
.{ .word = "Font", .action = .font, .doc = "The body font, by name or path, and its size." },
.{ .word = "TaglineSize", .action = .tagline_size, .doc = "Scale the tag font, a percentage." },
.{ .word = "WindowOpacity", .action = .window_opacity, .doc = "The window's opacity, a percentage." },
- .{ .word = "WindowBlur", .action = .window_blur, .doc = "The blur behind a translucent window, a radius." },
- .{ .word = "JumpScope", .action = .{ .choice = .jump_scope }, .doc = "What Back and Forward keep to: file, the focused pane's file until it runs out that way, or all, every place in order." },
.{ .word = "CallstackDepth", .action = .callstack_depth, .doc = "Caller levels collected by Callstack, 1 through 64; default 8. Bare, it says the current limit." },
.{ .word = "Tab", .action = .tab, .doc = "A tab's width in cells, 1 through 16, in every pane; bare, it says the width." },
};
@@ -917,8 +899,8 @@ pub const Runtime = struct {
for (std.enums.values(Toggle)) |field| if (actionCount(.{ .toggle = field }) != 1)
@compileError("runtime toggle must occur exactly once: " ++ @tagName(field));
if (actionCount(.shell) != 1 or actionCount(.theme) != 1 or actionCount(.font) != 1 or
- actionCount(.tagline_size) != 1 or actionCount(.window_opacity) != 1 or actionCount(.window_blur) != 1)
- @compileError("Shell, Theme, Font, TaglineSize, WindowOpacity, and WindowBlur actions must each occur exactly once");
+ actionCount(.tagline_size) != 1 or actionCount(.window_opacity) != 1)
+ @compileError("Shell, Theme, Font, TaglineSize and WindowOpacity actions must each occur exactly once");
}
pub fn apply(state: *Runtime, setting: Setting, argument: ?[]const u8) bool {
@@ -945,7 +927,6 @@ pub const Runtime = struct {
state.window_opacity = number(u8, argument, " \t\r\n", 0, 100) orelse return false;
state.window_opacity_pending = true;
},
- .window_blur => state.window_blur = number(u8, argument, " \t\r\n", 0, 100) orelse return false,
// Bare, it returns to the default directory. Else an absolute or
// `~` path, to a directory there or to be made, that may be
// written: a Dump there could never be, refused now.
@@ -999,7 +980,7 @@ pub const Runtime = struct {
/// words (`choices`), else its range or the kind of thing it takes.
pub fn takes(action: Action) ?[]const u8 {
return choices(action) orelse switch (action) {
- .inactive_dim, .window_opacity, .window_blur => "0-100 (a percentage)",
+ .inactive_dim, .window_opacity => "0-100 (a percentage)",
.grip_width => "50-300 (a percentage)",
.tab => "1-16 (cells)",
.callstack_depth => "1-64 (levels)",
@@ -1092,7 +1073,7 @@ pub const Runtime = struct {
else
try out.print("{s} {s}\n", .{ setting.word, context.theme_name }),
// A number in a field named as its action.
- inline .window_opacity, .window_blur, .inactive_dim, .callstack_depth, .tab, .grip_width => |_, tag| try out.print("{s} {d}\n", .{ setting.word, @field(state, @tagName(tag)) }),
+ inline .window_opacity, .inactive_dim, .callstack_depth, .tab, .grip_width => |_, tag| try out.print("{s} {d}\n", .{ setting.word, @field(state, @tagName(tag)) }),
.dump_dir => {
const dir = if (state.dump_dir.len > 0) state.dump_dir.get() else context.default_dump_dir;
if (dir.len > 0) try out.print("{s} {s}\n", .{ setting.word, dir }) else try out.print("# {s} (none)\n", .{setting.word});
@@ -1228,22 +1209,6 @@ pub const Runtime = struct {
try std.testing.expect(state.window_opacity_pending);
}
- test "window blur defaults off and validates without changing opacity" {
- const setting = find("WindowBlur").?;
- var state: Runtime = .{};
- try std.testing.expectEqual(@as(u8, 0), state.window_blur);
- try std.testing.expectEqual(Capability.window_blur, availability(setting.action).?);
- for ([_][]const u8{ "0", " 40\n", "100" }, [_]u8{ 0, 40, 100 }) |argument, expected| {
- try std.testing.expect(apply(&state, setting, argument));
- try std.testing.expectEqual(expected, state.window_blur);
- try std.testing.expectEqual(@as(u8, 100), state.window_opacity);
- }
- for ([_]?[]const u8{ null, "", " \t\n", "101", "-1", "+40", "40%", "0.5", "40 20", "4_0", "0x28", "999999999999999" }) |argument| {
- try std.testing.expect(!apply(&state, setting, argument));
- try std.testing.expectEqual(@as(u8, 100), state.window_blur);
- }
- }
-
test "font request tuple rejects atomically" {
var state: Runtime = .{};
try std.testing.expect(requestFont(&state, "/fonts/old.ttf", "Old", 1200));
@@ -1286,15 +1251,13 @@ pub const Runtime = struct {
.font_picker = true,
.tagline_font_size = true,
.window_opacity = true,
- .window_blur = true,
.pixels = true,
},
.state = &state,
};
const values = [_][2][]const u8{
- .{ "TaglineSize", "73" }, .{ "WindowOpacity", "85" }, .{ "WindowBlur", "40" },
+ .{ "TaglineSize", "73" }, .{ "WindowOpacity", "85" },
.{ "MessageLinger", "1500" }, .{ "DumpDir", "~/dumps" },
- .{ "JumpScope", "all" },
.{ "GripWidth", "200" }, .{ "InactiveDim", "35" }, .{ "CallstackDepth", "16" },
.{ "Tab", "8" },
};
@@ -1339,7 +1302,7 @@ pub const Runtime = struct {
try writeReport(&out, defaults_context);
const defaults_report = storage[0..out.end];
// A setting this shell does not have reads so, as a comment.
- for ([_][]const u8{ "# WindowOpacity unsupported\n", "# WindowBlur unsupported\n", "# Font unsupported\n", "# TaglineSize unsupported\n" }) |expected|
+ for ([_][]const u8{ "# WindowOpacity unsupported\n", "# Font unsupported\n", "# TaglineSize unsupported\n" }) |expected|
try std.testing.expect(std.mem.indexOf(u8, defaults_report, expected) != null);
try std.testing.expect(std.mem.indexOf(u8, defaults_report, "Font in use") == null);
// Every line before the blank one is a ctl word and its value, or a