Cherry Pick fix-misc-bugs-9: line endings, images, Markdown, diff preview cards, embedding seams

Merged
SO
2h ago
+9851-742

Zed fork changes for the Cherry Pick fix-misc-bugs-9-claude work (the 12 October QA report), pinned by CodeCraftersLLC/cherrypick#164.

46 commits. Highlights:

  • Line endings: a buffer remembers where its line endings change; save and reload write each line's own ending (CR-only, mixed, CRLF), and blame and file writers follow the per-line endings.
  • Images: one bounded, EXIF-upright decoder (lenient ICO, header-only metadata, bounded SVG rasters, animated GIF/WebP within the raster limits); a PNG too large to decode whole is streamed into a bounded thumbnail.
  • Markdown: inline HTML and collapsible <details>; Mermaid failures say why and keep the source; a link to a missing heading says so.
  • git_ui diff preview: cards say why a side has no picture, name the size limit, and never drop an unreadable file.
  • Embedding seams: settings from a repository can be ignored by the host; debugger affordances and blame can be turned off; open_url_or_file allowlist; Open in Default App hidden for programs; EntryRenamed carries the old path.
  • Accessibility and tests: VisualTestContext::enable_accessibility, readable scrollbar bounds, screen-reader Click runs click handlers directly.
  • Windows: the vsync loop leaves minimised and hidden windows alone; WM_SIZE logging.

The commit list holds the detail; each commit has its own tests.


[!NOTE]
Medium Risk
Touches editor gutter/debug paths, git blame I/O with mixed line endings, and a large new image decode surface; changes are mostly gated for embedders and bounded by limits, but regressions could affect blame accuracy, diff previews, or a11y click behavior.

Overview
This cherry-pick batch tightens embedding behavior (hosts that do not run the full Zed shell), text/git correctness, image handling, and diff preview UX.

Line endings move from a single buffer-wide LineEnding to LineEndings (per-line / mixed). Saves, fake FS, buffer diff base-text updates, and git blame stdin now use chunks_with_line_endings so mixed CR/LF/CRLF files blame correctly.

Editor & git UI for embedders: Editor::set_debugging_enabled(false) strips breakpoint store, inline values, and debug gutter menu entries; blame is gated on BlameRenderer::is_available() (placeholder renderer counts as off). Project diff adds show_remote_status so embedded “view only” mode does not show a bogus “Remote up to date” line. CSV tabular preview sets enabled_for_all() so the preview button works in release without a flag store.

File finder: optional global set_new_name_validator blocks “Create file” / split-open for rejected names (with preview + tests); empty history shows “Type to search…” instead of “No matches”.

Commit diff preview stops faking load/truncation failures as multibuffer text. Files become notice cards or binary before/after cards with NoPreviewReason (budget, size limit, undecodable image, etc.); captions and truncation copy are explicit. Card cap applies to binary cards only; notices are always shown.

gpui images: new image_decode module centralizes raster decode (limits, EXIF upright, ICO largest-entry + RGB PNG fallback), decode_bgra_frames for the image cache, and streaming png_thumbnail for oversized PNGs without allocating the full raster. png 0.18 added to the workspace.

Accessibility: while a11y is active, on_click registers an Action::Click handler that invokes click listeners with a keyboard ClickEvent (no hit-test), so clipped/covered controls still activate; tests add enable_accessibility / simulate_a11y_action on VisualTestContext.

Misc: project::Event::EntryRenamed struct match update in the editor; editor tests for disabled debugging and blame without renderer.

Reviewed by Cursor Bugbot for commit 1e7463323fb9f9032f54c7d60539f17c7e7fc30f. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features
    • Markdown previews support inline HTML formatting, links, and expandable <details> sections.
    • Commit previews show clearer notices when files or images can’t be displayed.
    • File creation and renaming show host-provided name validation errors; the file finder offers guidance when no search query is entered.
    • Accessibility actions can activate clickable controls, including controls clipped by their containers.
    • Project settings can be ignored, Mermaid preview errors explain why diagrams can’t render, and project diffs show clearer remote status.
  • Bug Fixes
    • Mixed line endings are preserved when editing, saving, formatting, and viewing Git blame.
    • Unavailable debugger and Git blame actions are no longer shown.
    • External links and Markdown image paths are restricted to supported destinations.
    • Modal focus is restored when needed; “Open in Default App” is withheld for remote items and programs, and cut-and-paste in the same folder no longer creates a copy.