summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CHANGELOG.md5
-rw-r--r--src/Core.zig23
-rw-r--r--src/File.zig13
-rw-r--r--src/Tables.zig11
-rw-r--r--src/body_layer.zig6
-rw-r--r--src/builtins.zig34
-rw-r--r--src/colors.zig15
-rw-r--r--src/config.zig29
-rw-r--r--src/draw.zig18
-rw-r--r--src/exec.zig10
-rw-r--r--src/gui/gui.zig59
-rw-r--r--src/ninep/ctl.zig2
-rw-r--r--src/surface.zig3
-rw-r--r--src/terminal.zig9
14 files changed, 49 insertions, 188 deletions
diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md
index ee968587..88482e92 100644
--- a/src/CHANGELOG.md
+++ b/src/CHANGELOG.md
@@ -6,6 +6,11 @@
its word refused as any unknown one is (an init file that still says it
gets a notice naming its line), and a dump that kept it loads as before:
- Tagbottom: a pane's tag is at its head (`SPC t b` with it).
+ - Colors: text panes and terminals are coloured (`SPC t c` with it).
+ - TreeContextTagStyle: TreeContext rows draw in the tag's style.
+ - FocusTint: the focused pane's and column's tags are tinted.
+ - SyntaxBold: keywords are not bold.
+ - Ligatures: the window draws a font's ligatures.
- What pardes keeps on disk is in xitdb databases now (a pinned commit of
github.com/xit-vcs/xitdb, pure Zig). The state file, `pardes.xitdb` in
diff --git a/src/Core.zig b/src/Core.zig
index 38493b93..a455cf1c 100644
--- a/src/Core.zig
+++ b/src/Core.zig
@@ -1777,7 +1777,7 @@ pub fn sync(p: *Pardes) void {
// The session's part of the pane's view geometry (File.geometry),
// and its context declarations.
if (pane.file) |*f| pardes.panes.File.refreshContext(p, pane, f);
- pane.view = .{ .wrap = p.settings.wrap, .layered = p.settings.tree_context_tag_style, .body_h = p.row_metrics.body_h, .tagline_h = p.row_metrics.tagline_h, .rect_h = r.h };
+ pane.view = .{ .wrap = p.settings.wrap, .body_h = p.row_metrics.body_h, .tagline_h = p.row_metrics.tagline_h, .rect_h = r.h };
// The tag takes a row per line, leaving the body one row if it
// had any; a folded pane shows its first line only. Its prefix
// is made once, on the stack: this runs on every event, and not
@@ -2366,7 +2366,7 @@ test "LocationsConfig command reports partial updates and survives restore" {
try std.testing.expectEqual(expected, restored.locations_config);
}
-test "TreeContext tag style preserves message rows and its opt-out survives restore" {
+test "TreeContext rows in the tag style keep the message rows" {
if (comptime !syntax.enabled) return error.SkipZigTest;
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 });
defer p.deinit();
@@ -2380,7 +2380,6 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest
pane.msg_len = 0;
p.sync();
_ = try p.render(p.scratch.allocator());
- try std.testing.expect(p.settings.tree_context_tag_style);
const full_height = p.surface.body_layers[0].viewport.h;
try std.testing.expect(p.surface.body_layers[0].rows > full_height);
try std.testing.expectEqual(FontRole.tagline, p.surface.body_layers[0].cells[0].style.font_role);
@@ -2408,16 +2407,6 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest
_ = try p.render(p.scratch.allocator());
try std.testing.expectEqual(full_height, p.surface.body_layers[0].viewport.h);
p.prefix = .none;
- try std.testing.expect(p.executeBuiltinLine(0, "TreeContextTagStyle"));
- p.sync();
- _ = try p.render(p.scratch.allocator());
- try std.testing.expectEqual(@as(u16, 0), p.surface.body_layers[0].rows);
- try std.testing.expectEqual(@as(u16, 0), pane.body_rows);
- try std.testing.expectEqual(FontRole.body, p.surface.at(r.x + config.GUTTER, p.bodyTop(pane, r)).style.font_role);
- try dump.dumpState(p);
- const restored = try dump.initFromDump(p.gpa, .{ .tty_only = true }, p.dump_out.?);
- defer restored.deinit();
- try std.testing.expect(!restored.settings.tree_context_tag_style);
}
test "TreeContext command and custom tag survive a workspace round trip" {
@@ -3452,8 +3441,6 @@ test "tabbed file aligns syntax cursor and mouse at the nearest insertion gap" {
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .cols = 60, .rows = 12 });
defer p.deinit();
- // Bold is an explicit preference; use it to expose the glyph boundaries.
- try std.testing.expect(p.executeBuiltinLine(0, "SyntaxBold"));
const pane = try p.setTestFile("\treturn x\n");
const f = &pane.file.?;
f.highlights = try p.tree_sitter_gpa.alloc(u8, f.content.len);
@@ -3469,10 +3456,12 @@ test "tabbed file aligns syntax cursor and mouse at the nearest insertion gap" {
const rect = p.rects[0];
const text_x = rect.x + config.GUTTER + config.PREFIX_W;
const body_y = rect.y + BOX_H;
+ // The keyword's ink shows the glyph boundaries.
+ const kw: Color = .{ .rgb = p.theme().kw };
for (0..config.tab_width) |col|
- try std.testing.expect(!surface.at(text_x + @as(u16, @intCast(col)), body_y).style.bold);
+ try std.testing.expect(!std.meta.eql(kw, surface.at(text_x + @as(u16, @intCast(col)), body_y).style.fg));
for (0.."return".len) |col|
- try std.testing.expect(surface.at(text_x + config.tab_width + @as(u16, @intCast(col)), body_y).style.bold);
+ try std.testing.expectEqual(kw, surface.at(text_x + config.tab_width + @as(u16, @intCast(col)), body_y).style.fg);
try std.testing.expectEqual(text_x + config.tab_width, surface.cursor.?.x);
const click_x = text_x + config.tab_width + 2;
diff --git a/src/File.zig b/src/File.zig
index 5b3c6bb7..038f4920 100644
--- a/src/File.zig
+++ b/src/File.zig
@@ -1580,13 +1580,6 @@ pub fn refreshHighlights(p: *Pardes) void {
continue;
}
if (!f.syntax_dirty) continue;
- if (!p.settings.colors) {
- if (f.highlights.len > 0) p.tree_sitter_gpa.free(f.highlights);
- f.highlights = &.{};
- f.highlight_start = 0;
- f.syntax_dirty = false;
- continue;
- }
// ponytail: a stretch over `long_paint` bytes (a minified line) is
// painted only around the caret, so a key typed in a 500 KB line
// parses 16 KB, not the line (190 ms a key in ReleaseSafe; 25 ms at
@@ -1941,7 +1934,7 @@ pub fn drawGutter(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, tx: u16,
const cell = s.at(tx + @as(u16, @intCast(col)), body_y + @as(u16, @intCast(context_row)));
cell.default = false;
cell.style.bg = .{ .rgb = context_bg };
- if (p.settings.tree_context_tag_style) cell.style.font_role = .tagline;
+ cell.style.font_role = .tagline;
}
}
var vr: u16 = 0;
@@ -2021,7 +2014,7 @@ pub const DiffTints = struct {
fn synStyle(p: *Pardes, sy: syntax.Syn) ?SynStyle {
return switch (sy) {
.none => null,
- .keyword => .{ .fg = p.theme().kw, .bold = p.settings.syntax_bold },
+ .keyword => .{ .fg = p.theme().kw, .bold = false },
.string => .{ .fg = p.theme().str, .bold = false },
.number => .{ .fg = p.theme().num, .bold = false },
.comment => .{ .fg = p.theme().comment, .bold = false },
@@ -2255,7 +2248,7 @@ pub const DiffOutput = struct {
/// The rows are the terminal's own, so a line it wrapped goes on in the
/// row below (syntax.highlightDiffRows).
pub fn recolorDiffOutput(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, tx: u16, tw: u16, body_h: u16, body: []const u8) void {
- if (pane.command == null or !p.settings.colors) return;
+ if (pane.command == null) return;
const tz = tracy.zone(@src(), "diffRecolor");
defer tz.end();
const rows = p.diff_output.lines(p, pane) orelse return;
diff --git a/src/Tables.zig b/src/Tables.zig
index 7baffdf9..b0b1930e 100644
--- a/src/Tables.zig
+++ b/src/Tables.zig
@@ -721,7 +721,6 @@ pub fn paint(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, tx: u16, tw:
const f = if (pane.file) |*file| file else return;
if (f.tables.list.items.len == 0) return;
const th = p.theme();
- const tint = p.settings.colors;
const rule_fg: Color = .{ .rgb = th.border orelse th.lineno };
const head_bg: Color = .{ .rgb = th.tag_bg };
const prefix: usize = File.gutterWidth(pane);
@@ -751,9 +750,9 @@ pub fn paint(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, tx: u16, tw:
const cell = s.at(tx + @as(u16, @intCast(col + i)), y);
if (delimiter) {
glyph(cell, rule_h);
- if (tint) cell.style.fg = rule_fg;
+ cell.style.fg = rule_fg;
}
- if (header and tint) cell.style.bg = head_bg;
+ if (header) cell.style.bg = head_bg;
}
col += pads[k].cells;
k += 1;
@@ -773,16 +772,16 @@ pub fn paint(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, tx: u16, tw:
rule_right
else
rule_cross);
- if (tint) cell.style.fg = rule_fg;
+ cell.style.fg = rule_fg;
cell.style.bold = false;
} else if (delimiter) {
if (text[at] == '-' or text[at] == ' ') glyph(cell, rule_h);
- if (tint) cell.style.fg = rule_fg;
+ cell.style.fg = rule_fg;
} else if (header) {
cell.default = false;
cell.style.bold = true;
}
- if (header and tint) for (0..cells) |i| {
+ if (header) for (0..cells) |i| {
if (col + i < tw) s.at(tx + @as(u16, @intCast(col + i)), y).style.bg = head_bg;
};
col += cells;
diff --git a/src/body_layer.zig b/src/body_layer.zig
index b8336b7b..bd9e065b 100644
--- a/src/body_layer.zig
+++ b/src/body_layer.zig
@@ -175,7 +175,7 @@ pub fn joinBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane,
panes.File.geometry(pane);
// Which rows are context rows is decided by the text the body shows: a
// layer taller than the grid's rows when there are any.
- if (!p.settings.tree_context_tag_style or pane.collapsed or r.h <= pane.tag_rows or pane.body_rows == 0)
+ if (pane.collapsed or r.h <= pane.tag_rows or pane.body_rows == 0)
return renderBody(p, s, arena, pane, r, id, active, rail);
const viewport_rows = r.h - pane.tag_rows;
const logical_rows: usize = pane.body_rows;
@@ -279,13 +279,13 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane
if (pane.file) |*f| {
panes.File.drawGutter(p, s, pane, r, tx, tw, body_h, active);
panes.Query.paintMark(p, s, pane, r, body_h);
- if (p.settings.colors and pane.colorAlgo() != .none)
+ if (pane.colorAlgo() != .none)
panes.File.recolorSyntax(p, s, pane, f, r, tx, tw, body_h);
panes.Tables.paint(p, s, pane, r, tx, tw, body_h);
panes.File.drawWrapMarkers(p, s, pane, r, tx, tw, body_h, pane_bg);
pane.places.paint(p, s, pane, r, body_h);
panes.Query.paint(p, s, pane, r, body_h);
- } else if (pane.isTerminal() and p.settings.colors) {
+ } else if (pane.isTerminal()) {
panes.terminal.recolorAnsi(p, s, pane, r, tx, tw, body_h, body);
panes.File.recolorDiffOutput(p, s, pane, r, tx, tw, body_h, body);
}
diff --git a/src/builtins.zig b/src/builtins.zig
index 5186ac55..26d6c770 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -23,9 +23,6 @@ pub const frontend: config.Runtime.Capabilities = .{
.tagline_font_size = pardes.platform != .tui,
.window_opacity = pardes.platform == .gui or pardes.platform == .macos,
.window_blur = pardes.platform == .macos,
- // Only the SDL shell shapes with HarfBuzz and honours the setting. macOS
- // draws CoreText ligatures of its own, but nothing there reads it yet.
- .ligatures = pardes.platform == .gui,
// The grip's width, the cursor's blink and the Pet are the SDL window's.
.pixels = pardes.platform == .gui,
};
@@ -35,8 +32,8 @@ pub const frontend: config.Runtime.Capabilities = .{
/// its own frontend does (`viewCapabilities`), so a terminal's replica of a
/// window's session steps as the window's own does, and back.
pub const desktop = pardes.platform == .tui or pardes.platform == .gui;
-const window_capabilities: config.Runtime.Capabilities = .{ .font_picker = true, .tagline_font_size = true, .window_opacity = true, .window_blur = false, .ligatures = true, .pixels = true };
-const terminal_capabilities: config.Runtime.Capabilities = .{ .font_picker = false, .tagline_font_size = false, .window_opacity = false, .window_blur = false, .ligatures = false, .pixels = false };
+const window_capabilities: config.Runtime.Capabilities = .{ .font_picker = true, .tagline_font_size = true, .window_opacity = true, .window_blur = false, .pixels = true };
+const terminal_capabilities: config.Runtime.Capabilities = .{ .font_picker = false, .tagline_font_size = false, .window_opacity = false, .window_blur = false, .pixels = false };
/// The words this build has: a desktop build's are the window's.
pub const capabilities: config.Runtime.Capabilities = if (desktop) window_capabilities else frontend;
@@ -488,33 +485,6 @@ test "Look does not announce itself on the message row; Del still does" {
try std.testing.expect(registry.announces(Builtin.Del));
}
-test "Ligatures is a setting only in the shell that shapes text" {
- const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true });
- defer p.deinit();
- // A desktop build has the word, which a window's view takes alone.
- try std.testing.expectEqual(desktop, @hasField(registry.Builtin(), "Ligatures"));
- const exists = registry.here(p, .Ligatures);
- try std.testing.expectEqual(pardes.platform == .gui, exists);
- // Taken either way: run, or said to be GUI-only.
- try std.testing.expect(p.executeBuiltinLine(p.active, "Ligatures off"));
- try std.testing.expectEqual(!exists, p.settings.ligatures);
- var storage: [8192]u8 = undefined;
- var out: std.Io.Writer = .fixed(&storage);
- try config.Runtime.writeReport(&out, .{
- .startup_config_path = null,
- .platform = @tagName(pardes.platform),
- .theme_name = p.theme().name,
- .compiled_default_shell = config.defaultShell(),
- .hover_delay_frames = config.look_preview_delay_frames,
- .native_images = false,
- .capabilities = viewCapabilities(p),
- .state = &p.settings,
- });
- try std.testing.expectEqual(exists, std.mem.indexOf(u8, storage[0..out.end], "Ligatures off\n") != null);
- // A GUI-only setting reads so elsewhere, as every one the shell lacks.
- try std.testing.expectEqual(!exists, std.mem.indexOf(u8, storage[0..out.end], "Ligatures unsupported\n") != null);
-}
-
// ---- the two acme verbs ----
/// Look at its argument: open the file or address it names, else find the word, as a right click does.
diff --git a/src/colors.zig b/src/colors.zig
index f09bf9db..b028888f 100644
--- a/src/colors.zig
+++ b/src/colors.zig
@@ -1000,15 +1000,12 @@ test "line numbers stay quiet without a current-line tag background" {
p.sync();
const x = p.rects[0].x + config.GUTTER;
const y = p.rects[0].y + BOX_H;
- for ([_]bool{ false, true }) |focus_tint| {
- p.settings.focus_tint = focus_tint;
- const surface = try p.render(p.scratch.allocator());
- try std.testing.expectEqual(Color{ .rgb = .{ 95, 95, 95 } }, surface.at(x, y).style.fg);
- try std.testing.expectEqual(Color{ .rgb = .{ 70, 70, 70 } }, surface.at(x, y + 1).style.fg);
- try std.testing.expectEqual(Color{ .rgb = custom.bg.? }, surface.at(x, y).style.bg);
- try std.testing.expect(surface.at(x, y).style.bold);
- try std.testing.expect(!surface.at(x, y + 1).style.bold);
- }
+ const surface = try p.render(p.scratch.allocator());
+ try std.testing.expectEqual(Color{ .rgb = .{ 95, 95, 95 } }, surface.at(x, y).style.fg);
+ try std.testing.expectEqual(Color{ .rgb = .{ 70, 70, 70 } }, surface.at(x, y + 1).style.fg);
+ try std.testing.expectEqual(Color{ .rgb = custom.bg.? }, surface.at(x, y).style.bg);
+ try std.testing.expect(surface.at(x, y).style.bold);
+ try std.testing.expect(!surface.at(x, y + 1).style.bold);
// Old ThemeFile palettes need no new field, and do not regain the block.
p.custom_theme.?.lineno_active = null;
const fallback = try p.render(p.scratch.allocator());
diff --git a/src/config.zig b/src/config.zig
index bea5dbbf..edfaf3ed 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -123,11 +123,7 @@ pub const leader_path = paths: {
.JumpScope = null,
.Debug = "td",
.Msg = null,
- .Colors = "tc",
- .FocusTint = null,
- .SyntaxBold = null,
.Verbose = null,
- .TreeContextTagStyle = null,
.Wrap = "tw",
.NextColor = "tn",
.Themes = "tt",
@@ -160,7 +156,6 @@ 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.pixels) table.set(.CursorBlink, null);
table.set(.JumpTrail, null);
table.set(.ProgramEsc, null);
@@ -687,19 +682,12 @@ pub const kill_to_line_end: []const Chord = &.{.{ .cp = 'k', .ctrl = true }};
pub const Runtime = struct {
theme: usize = 0,
- colors: bool = true,
wrap: bool = true,
- tree_context_tag_style: bool = true,
debug: bool = false,
- focus_tint: bool = true,
/// The workspace tag row. Native shells with their own chrome (the macOS
/// menu bar) turn it off and carry its commands there instead; the core
/// keeps the row as the acme tradition everywhere else.
workspace_tag: 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,
/// How far the unfocused panes' text fades toward its ground, a percent
/// (0 off), kept above the pair's own contrast or 4.5, whichever is
/// lower: a setting alone, which the window draws (gui.zig's Dim) and a
@@ -850,8 +838,6 @@ 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,
/// The shell draws its own pixels (the SDL window): the grip at
/// GripWidth, its own cursor blink, the Pet.
pixels: bool = false,
@@ -859,7 +845,7 @@ pub const Runtime = struct {
pub const Capability = std.meta.FieldEnum(Capabilities);
- pub const Toggle = enum { colors, wrap, tree_context_tag_style, debug, focus_tint, syntax_bold, pager_color, verbose, ligatures, cursor_blink, jump_trail, program_esc };
+ pub const Toggle = enum { wrap, debug, pager_color, verbose, cursor_blink, jump_trail, program_esc };
pub const Action = union(enum) {
toggle: Toggle,
@@ -904,7 +890,6 @@ pub const Runtime = struct {
.window_blur => .window_blur,
.grip_width => .pixels,
.toggle => |field| switch (field) {
- .ligatures => .ligatures,
.cursor_blink => .pixels,
else => null,
},
@@ -915,14 +900,9 @@ pub const Runtime = struct {
// The builtin registry and DumpConfig report share this command table.
pub const settings = [_]Setting{
- .{ .word = "Colors", .action = .{ .toggle = .colors }, .doc = "Syntax colours in text panes, on or off." },
.{ .word = "Wrap", .action = .{ .toggle = .wrap }, .doc = "Long lines wrap onto the next row, on or off." },
- .{ .word = "TreeContextTagStyle", .action = .{ .toggle = .tree_context_tag_style }, .doc = "A pane's TreeContext rows draw in the tag's style, on or off." },
.{ .word = "Debug", .action = .{ .toggle = .debug }, .doc = "A small box of frame statistics at the top right, on or off." },
- .{ .word = "FocusTint", .action = .{ .toggle = .focus_tint }, .doc = "The focused pane's and column's tags are tinted, on or off." },
- .{ .word = "SyntaxBold", .action = .{ .toggle = .syntax_bold }, .doc = "Keywords and the like are drawn bold, on or off." },
.{ .word = "Verbose", .action = .{ .toggle = .verbose }, .doc = "A builtin says its own name on the message row as it runs, on or off." },
- .{ .word = "Ligatures", .action = .{ .toggle = .ligatures }, .doc = "A font's programming ligatures draw across their cells, 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." },
@@ -1238,8 +1218,8 @@ pub const Runtime = struct {
test "simple setting application mutates only its plain field" {
var state: Runtime = .{};
- try std.testing.expect(apply(&state, find("Colors").?, null));
- try std.testing.expect(!state.colors);
+ try std.testing.expect(apply(&state, find("Wrap").?, null));
+ try std.testing.expect(!state.wrap);
try std.testing.expect(apply(&state, find("Shell").?, " fish\n"));
try std.testing.expectEqualStrings("fish", state.shell.requested.get());
try std.testing.expect(state.shell.pending);
@@ -1346,7 +1326,6 @@ pub const Runtime = struct {
.tagline_font_size = true,
.window_opacity = true,
.window_blur = true,
- .ligatures = true,
.pixels = true,
},
.state = &state,
@@ -1399,7 +1378,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", "# Ligatures unsupported\n" }) |expected|
+ for ([_][]const u8{ "# WindowOpacity unsupported\n", "# WindowBlur 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
diff --git a/src/draw.zig b/src/draw.zig
index ce5f86c1..b63f61d8 100644
--- a/src/draw.zig
+++ b/src/draw.zig
@@ -204,7 +204,7 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface {
.border = chrome.border,
.topbar_rule = config.gui_topbar_pane_border_rgb orelse chrome.border,
.tag_bg = chrome.tag_bg,
- .tag_focus_bg = if (p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg,
+ .tag_focus_bg = chrome.tag_active_bg,
.tag_fg = chrome.tag_fg,
.scroll_track = chrome.scroll_track,
.scroll_thumb = chrome.scroll_thumb,
@@ -399,7 +399,7 @@ fn renderPane(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r:
// its ring. A pixel shell draws the ring (gui.zig gripDecor); a grid,
// which cannot, marks dirty in the grip's second cell with a bold `*`
// on the dirty colour, a cue that survives any palette.
- const band = if (active and p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg;
+ const band = if (active) chrome.tag_active_bg else chrome.tag_bg;
const dirty = tagline.dirty(pane);
const box_bg = gripBg(p, active);
const box_style: CellStyle = .{
@@ -484,7 +484,7 @@ fn paintHeaders(p: *Pardes, s: *Surface) !void {
const column_rows = layout.columnBarHeight(p);
if (column_rows > 0) for (0..p.ncol) |c| {
const region = s.region(.column_tag, c) orelse continue;
- const active = if (layout.findPane(p, p.active)) |found| found.col == c and p.settings.focus_tint else false;
+ const active = if (layout.findPane(p, p.active)) |found| found.col == c else false;
const bg = if (active) chrome.tag_active_bg else chrome.tag_bg;
const fg = if (active) chrome.tag_active_fg else chrome.tag_fg;
if (p.col_x[c] < s.cols) {
@@ -697,7 +697,7 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r
if (p.window_pick == id) {
for (0..rows) |row| temporary.tint(0, @intCast(row), temporary.cols, p.theme().sel_bg, p.theme().sel_fg);
}
- const tag_fg: Color = .{ .rgb = if (active and p.settings.focus_tint) chrome.tag_active_fg else chrome.tag_fg };
+ const tag_fg: Color = .{ .rgb = if (active) chrome.tag_active_fg else chrome.tag_fg };
// One layer, a row to each line the tag shows.
const layer = &s.tag_layers[id];
const count = @as(usize, columns) * rows;
@@ -709,7 +709,7 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r
layer.cols = columns;
layer.rows = rows;
layer.context_rows = 0;
- layer.bg = if (p.window_pick == id) p.theme().sel_bg else if (active and p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg;
+ layer.bg = if (p.window_pick == id) p.theme().sel_bg else if (active) chrome.tag_active_bg else chrome.tag_bg;
layer.cursor = if (p.header != null) null else if (temporary.cursor) |cursor|
.{ .x = cursor.x - TAG_TEXT_INSET, .y = cursor.y, .bar = cursor.bar }
else
@@ -804,8 +804,8 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane,
const rows = pane.tag_rows;
const page_rgb = th.bg orelse th.tag_bg;
// Focus is visible along the tag without changing its live text grid.
- const tag_bg = if (active and p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg;
- const tag_fg = if (active and p.settings.focus_tint) chrome.tag_active_fg else chrome.tag_fg;
+ const tag_bg = if (active) chrome.tag_active_bg else chrome.tag_bg;
+ const tag_fg = if (active) chrome.tag_active_fg else chrome.tag_fg;
const tag_style: CellStyle = .{ .fg = .{ .rgb = tag_fg }, .bg = .{ .rgb = tag_bg }, .font_role = .tagline };
// Padding belongs to the same font row but keeps its default ink: a
// role must not manufacture a foreground color for blank cells.
@@ -855,7 +855,7 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane,
// wrapped onto.
const first_line = whole[0 .. std.mem.indexOfScalar(u8, whole, '\n') orelse whole.len];
if (tagTintRange(pane, first_line, prefix_len)) |name| if (name.lo < name.hi) {
- const name_fg = if (active and p.settings.focus_tint) chrome.tag_active_name_fg else chrome.tag_name_fg;
+ const name_fg = if (active) chrome.tag_active_name_fg else chrome.tag_name_fg;
const a = modal.positionAt(shown.text, shown.fromReal(name.lo));
const b = modal.positionAt(shown.text, shown.fromReal(@min(name.hi, first_line.len)));
var row = @max(a.row, top);
@@ -1047,7 +1047,7 @@ test "a tag of three rows has its grip on the first, and band under it that stil
const top = p.tagTop(pane, r);
try std.testing.expect(pane.tag_rows >= 3);
const chrome = p.chromeTheme();
- const band = if (p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg;
+ const band = chrome.tag_active_bg;
for (0..config.GUTTER) |dx| {
const x = r.x + @as(u16, @intCast(dx));
try std.testing.expectEqual(Color{ .rgb = chrome.box }, s.at(x, top).style.bg);
diff --git a/src/exec.zig b/src/exec.zig
index 2f17733f..aaca3e0e 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -1012,8 +1012,6 @@ pub fn runBuiltinFrom(p: *Pardes, b: Builtin, id: usize, txt: []const u8, arg: ?
}
pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[]const u8) void {
- const previous_colors = p.settings.colors;
- const previous_context_style = p.settings.tree_context_tag_style;
const previous_tagline_percent = p.settings.font.tagline_percent;
switch (setting.action) {
.theme => {
@@ -1072,13 +1070,7 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[]
p.reportFailure(p.active, why catch "does not take that value");
},
}
- if (p.settings.colors != previous_colors) {
- for (p.panes) |slot| {
- const pane = slot orelse continue;
- if (pane.file) |*file| file.syntax_dirty = true;
- }
- }
- if (p.settings.tree_context_tag_style != previous_context_style or setting.action == .tab) {
+ if (setting.action == .tab) {
for (p.panes, 0..) |slot, id| {
p.surface.body_layers[id].rows = 0;
const pane = slot orelse continue;
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index 7c042703..07624c20 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -1770,7 +1770,6 @@ fn localSession(
core.frontend.native_image_patches = true;
observeGuiFont(g, core);
syncTaglineFont(g, core);
- syncLigatures(g, core);
var prompt_rcs = host_io.Shell.prepare();
defer prompt_rcs.deinit();
@@ -1916,7 +1915,6 @@ fn localSession(
shell.surface = null;
observeGuiFont(g, core);
syncTaglineFont(g, core);
- syncLigatures(g, core);
}
}
@@ -2164,7 +2162,6 @@ fn remoteSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_
var drew = false;
while (!link.quit) {
core.frames.period_ns = refreshNs(g);
- syncLigatures(g, core);
var own: OwnView = .{ .g = g, .in = &in, .s = &shell, .pointer = drew };
r.within(&own, OwnView.run);
client.feed();
@@ -3861,7 +3858,6 @@ fn pollFrame(ctx: ?*anyopaque) void {
syncWindowOpacity(g, core);
core.frames.period_ns = refreshNs(g);
syncTaglineFont(g, core);
- syncLigatures(g, core);
if (core.takeFontRequest()) |path| blk: {
const bytes = filesystem.readFile(s.gpa, path) catch {
core.rejectFont();
@@ -5117,7 +5113,7 @@ fn emitScrollRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *cons
/// A scrolling body's tree-sitter context rows hold still: the shifted
/// rows start under them and are clipped below their band, and where a
-/// body layer stacks them at the tagline's height (TreeContextTagStyle)
+/// body layer stacks them at the tagline's height
/// the rows under them are drawn up to meet them, where the layer has them.
fn holdContext(g: *Gui, surface: *const pardes.Surface, id: usize, held: u16, bh: u16, layout: CellLayout) struct { rows: u16, lift: f32 } {
const rows = @min(held, bh);
@@ -6393,17 +6389,6 @@ fn resetGlyphAtlas(g: *Gui) void {
g.atlas_dirty_bottom = atlas_h;
}
-/// A changed Ligatures setting drops what was resolved under the old one: the
-/// per-codepoint cells (which say whether a cell is shaped) and the shaped
-/// words. The atlas keeps its glyphs, plain and strip alike; the plain ones
-/// draw either way, and the strips come back into use when ligatures do.
-/// The frame this runs before redraws every cell with the new setting.
-fn syncLigatures(g: *Gui, core: *pardes.Pardes) void {
- if (core.settings.ligatures == g.words.ligatures) return;
- g.words.clear();
- g.words.ligatures = core.settings.ligatures;
-}
-
fn syncTaglineFont(g: *Gui, core: *pardes.Pardes) void {
if (!fitTaglineFont(g, core.settings.font.tagline_percent)) return;
const geom = windowCells(g);
@@ -6436,10 +6421,6 @@ const Words = struct {
text: std.ArrayListUnmanaged(u32) = .empty,
slots: std.ArrayListUnmanaged(Slot) = .empty,
shaped: std.ArrayListUnmanaged(c.UIShapedCell) = .empty,
- /// The Ligatures setting. Off, no cell is shaped, so each draws its own
- /// glyph, as in a font without ligatures. It lives here because every
- /// cell and word above was resolved under it (`syncLigatures`).
- ligatures: bool = true,
/// The word the last cell was in, so the rest of it costs a compare. It
/// is positional, so every frame forgets it: the cells change under it.
memo: Memo = .{},
@@ -6503,7 +6484,7 @@ fn wordBreak(a: WordCell, b: WordCell, i: usize, cursor: ?usize) bool {
/// The atlas slot `line[at]` draws: blank for a plain space (or concealed
/// text), its own glyph when no ligature could replace that glyph (every
-/// cell, in a font without ligatures or with Ligatures off), else its slice
+/// cell, in a font without ligatures), else its slice
/// of the word around it, shaped once and cached by the word's text. The
/// cells of a word being walked cost a compare. Taglines are not shaped: they are drawn at two pitches
/// (tagline_width in a tag layer, a whole cell in the grid), and a strip would
@@ -6524,7 +6505,7 @@ fn cellSlot(g: *Gui, line: []const pardes.Cell, at: usize, cursor: ?usize, role:
if (!known.found_existing) {
const drawn = glyphForCodepoint(g, here.cp);
const font = if (drawn.face == 0) g.font else g.fallbacks[drawn.face - 1].?.face;
- known.value_ptr.* = if (role == .body and words.ligatures and c.ui_font_substitutes(font, drawn.glyph) != 0)
+ known.value_ptr.* = if (role == .body and c.ui_font_substitutes(font, drawn.glyph) != 0)
Words.shape_slot
else
cachedGlyph(g, .{ .face = drawn.face, .glyph = drawn.glyph, .role = role, .decoration = here.decoration }) orelse g.space_slot;
@@ -6724,40 +6705,6 @@ test "a ligature draws across its cells, one slice each, and comes apart under t
try std.testing.expectEqual(c.ui_font_glyph(font, '-'), (try glyphKeyAt(&g, cellSlot(&g, &line, 1, null, .tagline))).glyph);
}
-test "Ligatures off draws a ligature as its cells' own glyphs, and on shapes it again" {
- const bytes = try filesystem.readFile(std.testing.allocator, "assets/MapleMono-NF-Regular.ttf");
- defer std.testing.allocator.free(bytes);
- const font = c.ui_font_new(bytes.ptr, @intCast(bytes.len)) orelse return error.FontInit;
- defer c.ui_font_free(font);
- var g = try textTestGui(font, 27);
- defer font_allocator = std.heap.smp_allocator;
- defer std.testing.allocator.free(g.atlas_stage);
- defer g.glyphs.deinit();
- defer g.words.deinit(std.testing.allocator);
- const core = try pardes.Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 });
- defer core.deinit();
-
- const text = "a->b";
- const line = textTestLine(text);
- var shaped: [text.len]Slot = undefined;
- for (&shaped, 0..) |*slot, i| slot.* = cellSlot(&g, &line, i, null, .body);
- try std.testing.expectEqual(shaped[1].u + g.cell_w, shaped[2].u);
-
- // Off, every cell is the slot the per-glyph path gives its codepoint.
- try std.testing.expect(core.executeBuiltinLine(core.active, "Ligatures off"));
- syncLigatures(&g, core);
- for (text, 0..) |byte, i| {
- const plain = cachedGlyph(&g, .{ .face = 0, .glyph = c.ui_font_glyph(font, byte), .role = .body }).?;
- try std.testing.expectEqual(plain, cellSlot(&g, &line, i, null, .body));
- }
- try std.testing.expect(!std.meta.eql(shaped[1], cellSlot(&g, &line, 1, null, .body)));
-
- // On again, the arrow is its strip once more.
- try std.testing.expect(core.executeBuiltinLine(core.active, "Ligatures on"));
- syncLigatures(&g, core);
- for (shaped, 0..) |slot, i| try std.testing.expectEqual(slot, cellSlot(&g, &line, i, null, .body));
-}
-
fn glyphKeyAt(g: *Gui, slot: Slot) !GlyphKey {
var it = g.glyphs.iterator();
while (it.next()) |entry| if (std.meta.eql(entry.value_ptr.*, slot)) return entry.key_ptr.*;
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 504a4e2d..f8cda59a 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -2529,7 +2529,7 @@ test "every word's /commands description is its own doc comment's first sentence
"\nRepl arg pane -- Binds this terminal as a language's REPL, so an exec on that language's files is typed into it instead of run.\n",
"\nJoincol root -- Fold the active pane's column into the one on its right, keeping its panes.\n",
"\nExit root -- Quit the editor, refusing once while a pane holds unsaved text: an Exit with nothing edited since discards it.\n",
- "\nColors arg root on,off -- Syntax colours in text panes, on or off.\n",
+ "\nWrap arg root on,off -- Long lines wrap onto the next row, on or off.\n",
// the reference's examples, as they read.
"\nNewcol root -- An empty column right of the keyboard's, its tag taking the keyboard.\n",
"\nSave arg pane -- Write the pane's text to its file, or to the file its argument names.\n",
diff --git a/src/surface.zig b/src/surface.zig
index ef1679a5..df9abac1 100644
--- a/src/surface.zig
+++ b/src/surface.zig
@@ -238,8 +238,7 @@ pub const Chrome = struct {
/// The rule under the workspace tag.
topbar_rule: [3]u8 = .{ 0, 0, 0 },
tag_bg: [3]u8 = .{ 0, 0, 0 },
- /// The focused pane's and column's tag underlay: `tag_bg` unless
- /// FocusTint is on.
+ /// The focused pane's and column's tag underlay.
tag_focus_bg: [3]u8 = .{ 0, 0, 0 },
tag_fg: [3]u8 = .{ 0, 0, 0 },
scroll_track: [3]u8 = .{ 0, 0, 0 },
diff --git a/src/terminal.zig b/src/terminal.zig
index a285d1f8..4cde89a4 100644
--- a/src/terminal.zig
+++ b/src/terminal.zig
@@ -2692,15 +2692,6 @@ test "terminal Filter keys indexed truecolor OSC and background-only cells throu
}
}
- // Colors remains the global master gate. The pane remembers Filter while
- // ANSI projection is dormant, and resumes it without replaying VT bytes.
- p.settings.colors = false;
- _ = frame.reset(.retain_capacity);
- const plain = try p.render(frame.allocator());
- try testing.expect(pane.tty_filter);
- try testing.expectEqual(asPardesColor(asGhostRgb(p.theme().fg.?)), plain.at(tx, body_y).style.fg);
- p.settings.colors = true;
-
p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]4;1;#ff0000\x1b\\" } });
const osc_red = pane.terminal.?.vt.colorForXterm(.{ .palette = 1 }).?;
try testing.expect(osc_red.eql(.{ .r = 255, .g = 0, .b = 0 }));