Skip to content

Preview markdown, and say what a file with no diff is - #16

Open
siegfriedpammer wants to merge 2 commits into
mainfrom
markdown-preview-and-binary-files
Open

siegfriedpammer wants to merge 2 commits into
mainfrom
markdown-preview-and-binary-files

Conversation

@siegfriedpammer

Copy link
Copy Markdown
Member

Two small reading features, one commit each.

Markdown preview (m, or View > Markdown Preview)

A change to a README or a document is read for what it will look like as much
as for what it says, and the diff can only show the source. The preview opens
as a tab of its own, so the source and the rendering are open at once:

  • renders the head side — what the change produces — and the base side for
    a file the change deletes, which has no head side left;
  • reuses the renderer, link command, selection handling and emphasis repair
    that the overview's description already uses, so it picks up whatever those
    learn. No new dependency, no new markdown code;
  • enabled only where there is something to render. On a .cs file the menu
    item is greyed rather than silently doing nothing;
  • typing m into a comment still types an m — the gesture handlers already
    stand aside for a text box.

Files with no diff are pointed out

A binary file, and a file that changed without its content changing (a rename,
a permission bit), were both built as a diff of two empty sides. That opens as
a blank document, which a reader cannot tell from a tool that failed to
load the file — and the changed-files list showed them with no counts at all,
beside files that genuinely changed nothing.

Now the tab says which of the two it is, and for a binary file how the sides
compare in size — whether the image got bigger is the whole of what a review
can say about it, and git knows it via cat-file -s without reading the blob:

logo.png

Binary file: git compares the bytes and reports only that they differ, so there
is no textual diff to read.

Modified.  12 KB -> 14 KB (+2 KB)

The file list carries the same word (binary / no lines) where the counts
would be. It is still the file's own tab with the file's own path, so it can
be marked viewed and stepped past like any other — a binary file is part of a
change, and a reader ticking files off should not have to skip it.

Testing

Build clean, 0 warnings. 353 tests, 352 passing, 1 skipped (the pre-existing
basedpyright bootstrap); 11 new cases cover the description and size logic,
which is a pure function in Stampeded.Core.

Both features were driven in the running app against a scratch repo holding a
markdown change, a pure rename and a binary change — the preview via both the
menu and the m key, the binary page and the list badges by opening them.

Deliberately not included

The overview's cost table still shows +0 -0 ~0 min for these files. That
reads as accurate there — nothing to read is zero minutes — and a column for
it would be the one place this got wider rather than clearer. The queue you
pick files from and the document you open both say it, which is where the
question is asked.

🤖 Generated with Claude Code

Two kinds of file reach a review with no lines in them: a binary one, which
git compares byte by byte and reports only as differing, and one that changed
without its content changing - a rename, or a permission bit.

Both were built as a diff of two empty sides. That opens as a blank document,
which a reader cannot tell from a tool that failed to load the file, and the
changed-files list showed them with no counts at all, beside files that
genuinely changed nothing.

Now the tab says which of the two it is, and for a binary file how the sides
compare in size - whether the image got bigger is the whole of what a review
can say about it, and git already knows it without reading the blob. The list
carries the same word where the counts would be.

It is still the file's own tab, with the file's own path, so it can be marked
viewed and stepped past like any other: a binary file is part of a change and
a reader ticking files off should not have to skip it.

Claude-Session: https://claude.ai/code/session_01EgJ3xXgcismuaFmKhF6KD9
Assisted-by: Claude:claude-opus-5:Claude Code
A change to a README or a document is read for what it will look like as much
as for what it says, and the diff can only show the source: a reader deciding
whether a table still lines up, whether a link points where it claims, or how
a nested list comes out had nowhere in the tool to find out.

The preview is a tab of its own rather than a mode of the diff, so the source
and the rendering can be open at once - which is the arrangement the question
is usually asked in. It renders the head side, because that is what the change
produces, and the base side for a file the change deletes, which has no head
side left to render.

Nothing new draws it: the renderer, the link command, the selection handling
and the emphasis repair are the ones the overview's description already uses,
so a preview picks up whatever those learn.

On 'm', and in the View menu, where it is enabled only for a file there is
something to render for - offered on a .cs file it would do nothing, which
reads as a broken command rather than one that does not apply. Typing 'm' into
a comment still types an m: the gesture handlers already stand aside for a
text box.

Claude-Session: https://claude.ai/code/session_01EgJ3xXgcismuaFmKhF6KD9
Assisted-by: Claude:claude-opus-5:Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant