Skip to content

feat(details): wrap fields, fullscreen image viewer, click-to-copy - #48

Merged
devnull03 merged 7 commits into
mainfrom
worktree-details-panel-upgrades
Jul 20, 2026
Merged

devnull03 merged 7 commits into
mainfrom
worktree-details-panel-upgrades

Conversation

@devnull03

Copy link
Copy Markdown
Owner

Summary

Upgrades the details panel (crates/workspace/src/panels/details.rs). Four fixes share one root cause — flex items' min-*: auto pinning them to min-content size — plus two new features.

Fixes

  • Line breaks in field values — min_w_0 on the value cell lets long/unbreakable values (URIs, IDs) wrap instead of overflowing the row and forcing horizontal scroll.
  • Contain shrinks image width — min_w_0 on the image frame; it was floored at the photo's intrinsic width, so narrowing the dock never re-fit the width.
  • Column divider full height — items_stretch (was items_start); the one-line label cell's border_r previously stopped after the first line of a tall wrapped row.
  • Scrollbar clear of the resize edge — pr_2 on the fields panel so grabbing the dock edge doesn't catch the scrollbar.

Features

  • Click-to-copy field values (write_to_clipboard). Whole-value copy, not partial-select — the only selectable text component parses markdown/html and would mangle raw metadata.
  • Fullscreen viewer — a Maximize button (shown only for previewable images) opens the photo in a ~90% viewport dialog overlay with scroll-to-zoom and drag-to-pan (new ImageViewer view). Open-in-default-app and reveal-in-folder buttons unchanged.

Known v1 ceilings on the viewer: pan isn't clamped to image bounds, a drag released outside the overlay can stick, and zoom is center-anchored (not cursor-anchored).

Verification

Run locally against the changed crate (a full cold --workspace build in this fresh worktree runs 30+ min, so the full matrix is left to CI):

  • cargo fmt --all --check — passed
  • cargo clippy -p workspace --all-targets -- -D warnings -A dead_code — passed
  • cargo test -p workspace — passed (6/6, all details.rs tests)

GitHub CI runs the full --workspace fmt/clippy/test matrix on Windows + macOS.

Fix the details panel's field grid and image frame, all rooted in flex
items' `min-*: auto` pinning them to min-content size:

- Wrap long field values (`min_w_0` on the value cell) instead of
  overflowing the row horizontally.
- Let `ObjectFit::Contain` shrink the photo's width (`min_w_0` on the
  frame) when the dock narrows.
- Span the column divider down full-height wrapped rows
  (`items_stretch`, not `items_start`).
- Inset the fields scrollbar from the dock resize edge (`pr_2`).

Add click-to-copy on field values, and a Maximize button that opens the
photo in a ~90% viewport dialog overlay with scroll-to-zoom and
drag-to-pan (new `ImageViewer` view). Open-in-default-app and
reveal-in-folder buttons unchanged.
Address viewer feedback:

- Zoom did nothing: the img is a flex child, so sizing it to `relative(zoom)`
  was cancelled by flex-shrink snapping it back to the container. Pin it with
  `flex_shrink_0` so it actually scales.
- Overlay ran off-screen: the dialog card sat 10% from the top at 90%/85% of
  the viewport. Strip the card to transparent, `p_0`, `margin_top(0)`, and
  viewport-sized, and `Contain`-fit the image so it never exceeds the window.
- Scroll now zooms for trackpad (pixel deltas) and wheel (line deltas) alike,
  so ctrl+scroll zooms too; drag still pans.
- Show the filename top-left and zoom-out/zoom-in/close controls top-right,
  in place of the dialog's own title bar and close button.
- Size the viewer overlay to ~80% of the viewport, centered with a ~10%
  margin all around, instead of the full window — the default `Contain`
  fit then leaves breathing room rather than filling the screen edge to
  edge.
- Let zoom-out shrink below the initial fit (clamp floor 1.0 -> 0.1), so
  the image can go smaller than window-width.
Move the viewer out of details.rs into `image_viewer.rs` and stop using a
gpui_component dialog for it. A dialog layer occludes the whole window, so it
covered the custom title bar and made the window's close/minimize controls
unclickable, and its fixed viewport-fraction sizing overflowed the bottom of
the window.

The viewer is now held in an `ActiveImageViewer` global and mounted by
`Workspace` as an overlay over its own content — which already sits below the
title bar, so the window controls stay reachable. It fills that area with
`size_full` + `overflow_hidden` and `Contain`-fits the image inside a padded
box, so it sizes to the actual content area instead of hardcoded fractions and
can't overflow. Escape / the close button dismiss it; zoom and pan unchanged.
The overlay painted on top of the dock but registered no hitbox, so gpui
dispatched mouse and scroll events to the table behind it. `occlude()` the
overlay root so it captures them.
The image frame is a flex item in `resizable_panel`, so its min-content
height floored at the photo's intrinsic pixels and a tall image grew the
frame past the pane. Add `min_h_0` (the height twin of the existing
`min_w_0`) so the frame tracks the pane and `Contain` re-fits the image.
@devnull03
devnull03 marked this pull request as ready for review July 20, 2026 12:10
Copilot AI review requested due to automatic review settings July 20, 2026 12:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Reduce all 44 multi-line inline comment blocks to a single line each,
keeping the load-bearing rationale (gpui/flexbox overrides, dependency
edges, upstream issue numbers) while dropping the restated mechanics.

Delete BarRegistry::add_left/add_right default methods that only forwarded
to BarItems' identically-named methods; callers use items_mut() directly.

Note the ai crate and log_viewer.rs as deliberate audit exemptions in
CLAUDE.md so future bloat passes don't re-flag them.
@devnull03
devnull03 merged commit ef0683b into main Jul 20, 2026
2 checks passed
@devnull03
devnull03 deleted the worktree-details-panel-upgrades branch July 20, 2026 12:36
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.

2 participants