Skip to content

feat(core): make popup respect config sizes#367

Open
mammothb wants to merge 2 commits into
3rd:masterfrom
mammothb:feat/popup-respect-config-sizes
Open

feat(core): make popup respect config sizes#367
mammothb wants to merge 2 commits into
3rd:masterfrom
mammothb:feat/popup-respect-config-sizes

Conversation

@mammothb

Copy link
Copy Markdown
Contributor

Problem

scale_factor, max_width, max_height, max_width_window_percentage, and max_height_window_percentage were all silently ignored for markdown images rendered in popup mode (only_render_image_at_cursor_mode = "popup").

Fix

  • renderer.lua
    • Cap ALL geometry to the image's scaled natural size
  • document.lua
    • Popup window pre-computes final image size

Instead of always using screen_cols / 2 as the popup width, the popup now:

  1. Computes the scaled natural width (image_width / cell_width × scale_factor)
  2. Caps at half screen
  3. Applies max_width, max_width_window_percentage (vs screen)
  4. Derives height from aspect ratio, applies max_height, max_height_window_percentage
  5. Re-adjusts aspect ratio if height was constrained

Before

Details image

After

Details image

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