Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent cropping #48

Merged
merged 5 commits into from
Oct 12, 2023
Merged

Consistent cropping #48

merged 5 commits into from
Oct 12, 2023

Conversation

benlubas
Copy link
Contributor

@benlubas benlubas commented Oct 10, 2023

After this change we'll have consistent cropping behavior that follows these rules:

  • If an image is not mounted on a window & buffer it shouldn't be resized/cropped at all, the API user should have full control.
  • For images that are attached to a window and buffer it should behave the same and crop images at the window bounds, images should not be resized depending on scroll position.

Something of note, the existing get_global_offsets function defines the "bounds" of a window to exclude the sign column. This is helpful for placing image inline with text (you don't often want to cover the sign column). But this does mean it's harder to draw over a sign column of a specific window (which is something another plugin might want to do). This is just another thing that we might consider turning into an option in v2.0.0

screen_cap.mp4

Another note. In order to get this behavior I set my max_height_window_percentage to math.huge. Otherwise it shrinks the image and you can't see the crop happen on resize.

This finally (I hope) closes #42

This also fixes the issue where the markdown integration draws images over the status bar, but doesn't prevent an image from being drawn on the status bar if it's not bound to a window

@benlubas
Copy link
Contributor Author

benlubas commented Oct 10, 2023

Ahhh, the cropping doesn't work with borders at the moment, let me take a look at that

fixed in 602cff9 & 620f557

@3rd 3rd merged commit 9a53beb into 3rd:master Oct 12, 2023
1 check passed
@3rd
Copy link
Owner

3rd commented Oct 12, 2023

Sorry for the slow turnover, thanks again for the great work!

@benlubas
Copy link
Contributor Author

Not a problem at all, you've been awesome to work with!

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.

Inconsistent Cropping Behavior
2 participants