summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:34:07 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:02:08 -0300
commit22643b1a1f37f9bf8cc1fcd4a80fb0876b9a0ff9 (patch)
treef68d65b34e15bf6096f6c8707f93c73e114efcfc
parent07447259192dba875cdeb5767927f7512c2595b4 (diff)
downloadpardes-22643b1a1f37f9bf8cc1fcd4a80fb0876b9a0ff9.tar.gz
pardes-22643b1a1f37f9bf8cc1fcd4a80fb0876b9a0ff9.zip
pdf_view.isPath goes, no caller but its own test (deleted: a dump brings a PDF pane back by its state, never by its path's suffix), and Tables' closesAny is the fenceOf test it wrapped
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
-rw-r--r--src/Tables.zig9
-rw-r--r--src/pdf_view.zig6
-rw-r--r--test/panes.zig8
3 files changed, 2 insertions, 21 deletions
diff --git a/src/Tables.zig b/src/Tables.zig
index 765975dc..552d19d6 100644
--- a/src/Tables.zig
+++ b/src/Tables.zig
@@ -296,7 +296,8 @@ fn reflow(t: *Tables, gpa: std.mem.Allocator, f: *File.State) !void {
// Its tables, found as the whole text's are, then put in the old ones' place.
const before = t.list.items.len;
const prev = if (r0 == 0) "" else lineOf(content, starts, r0 - 1).text;
- const prev_blank = r0 == 0 or blank(prev) or closesAny(prev) or std.mem.startsWith(u8, prev[@min(indentOf(prev), prev.len)..], "#");
+ // Any fence line closes a block (a header may follow it).
+ const prev_blank = r0 == 0 or blank(prev) or fenceOf(prev) != null or std.mem.startsWith(u8, prev[@min(indentOf(prev), prev.len)..], "#");
const head = lineOf(content, starts, r0);
var at: Resume = .{ .at = head.start, .n = head.n, .fence = null, .prev_blank = prev_blank };
_ = try t.scanFrom(gpa, content, &at, @intCast(r1), false, 0, std.math.maxInt(u32));
@@ -307,12 +308,6 @@ fn reflow(t: *Tables, gpa: std.mem.Allocator, f: *File.State) !void {
t.lines = starts.len;
}
-/// Whether a line closes some fence (any fence line does, to the block
-/// after it: a header may follow it).
-fn closesAny(text: []const u8) bool {
- return fenceOf(text) != null;
-}
-
pub fn isMarkdown(path: []const u8) bool {
return std.ascii.endsWithIgnoreCase(path, ".md") or std.ascii.endsWithIgnoreCase(path, ".markdown");
}
diff --git a/src/pdf_view.zig b/src/pdf_view.zig
index d5c92fb6..71433729 100644
--- a/src/pdf_view.zig
+++ b/src/pdf_view.zig
@@ -59,12 +59,6 @@ pub const TintMode = if (enabled) pdf.TintMode else void;
pub const TintColors = if (enabled) pdf.TintColors else void;
pub const RenderRequest = if (enabled) pdf.RenderRequest else void;
-/// Dump records must remain recognizable as PDFs even in a build without
-/// MuPDF, where Look deliberately treats them as ordinary files.
-pub fn isPath(path: []const u8) bool {
- return std.ascii.endsWithIgnoreCase(path, ".pdf");
-}
-
pub const RasterPolicy = struct {
dpi: u16,
max_dimension: u16,
diff --git a/test/panes.zig b/test/panes.zig
index f472ba81..1e00fa94 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -2346,19 +2346,11 @@ const PdfTests = struct {
const pdf = panes.Pdf.pdf;
const Point = panes.Pdf.Point;
const Document = panes.Pdf.Document;
- const isPath = panes.Pdf.isPath;
const State = panes.Pdf.State;
const probeWord = panes.Pdf.probeWord;
const pointAtGeometry = panes.Pdf.pointAtGeometry;
const SectionRows = panes.Pdf.SectionRows;
- test "PDF dump paths are recognized independent of MuPDF support" {
- try std.testing.expect(isPath("manual.pdf"));
- try std.testing.expect(isPath("MANUAL.PDF"));
- try std.testing.expect(!isPath("manual.pdf.txt"));
- try std.testing.expect(!isPath("pdf"));
- }
-
test "feature-off PDF state is zero-sized" {
if (!enabled) try std.testing.expectEqual(@as(usize, 0), @sizeOf(State));
}