3rd / image.nvim

🖼️ Bringing images to Neovim.
MIT License
872 stars 35 forks source link

Overlap with floating windows #5

Closed yingzhu146 closed 1 year ago

yingzhu146 commented 1 year ago

Thanks a ton for this amazing plugin, already seems way more stable/reliable than what was before

NVIM v0.10.0-dev-429+g9f3c4c152-dirty + MacOS Ventura 13.4 M1 Max MBP + Kitty 0.28.1

Right now, images will just overlap with e.g. telescope or nvim-cmp.

Also, likely unrelated:

on the large image piece - this is often very much unintentionally large but these are images that are much smaller in the markdown. Maybe would be helpful to be able to define a default size that everything gets resized to? would work for many of my use cases

Thanks a ton for your hard work here 🙏

yingzhu146 commented 1 year ago

Actually - for others finding this, default size is possible via:

max_width = 50, max_height = 50 config options

still not finding the right size however

20230707-223144

and the following is still often triggered when moving over objects (leading to crashes sometimes)

Error executing lua callback: ...ocal/share/nvim/lazy/image.nvim/lua/image/utils/term.lua:25: Failed to get terminal size
stack traceback:
    [C]: in function 'assert'
    ...ocal/share/nvim/lazy/image.nvim/lua/image/utils/term.lua:25: in function 'get_size'
3rd commented 1 year ago

@yingzhu146 Hey, thanks for the issue. Performance should be better now, and the resize issue should be fixed when using Kitty, can you try the latest version? Looking at your image it seems like the positioning is very off, can you share a sample document & images to reproduce that? For the floating windows I'm planning on implementing a masking mechanism soon, will update here. Thanks again!

3rd commented 1 year ago

@yingzhu146 Added two new config options for toggling a window's images when it's overlapped, try setting window_overlap_clear_enabled to true. We have what we need for the masking math, but the magick rock isn't very friendly for this task, I guess this solution is ok for now.

yingzhu146 commented 1 year ago

Amazing, works like a charm! The initial loading appears quite a bit slower now but both movement over images and not overlapping over windows are now solved so I'll take the slower initial loads, so closing this!

There's still some image overlaps with some text, but that's a different issue and not a huge problem!

20230710-183900
3rd commented 1 year ago

Amazing, works like a charm! The initial loading appears quite a bit slower now but both movement over images and not overlapping over windows are now solved so I'll take the slower initial loads, so closing this!

There's still some image overlaps with some text, but that's a different issue and not a huge problem!

20230710-183900

Awesome!

It looms like it still renders at the wrong position, off by one on both x and y. Could you share a small config & documenr sample to reproduce this? I'd like to fix it. Is it a Neorg file?

About the initial load, it now handles resizing and cropping in two steps, and both are cached.

I'm thinking of dropping magick and making a separate helper with Go to handle all image operations, as well as masking, compositing, and backend communication. Would be testable, have better perf, and will be embeddable in anything, not just Neovim.

yingzhu146 commented 1 year ago

Amazing, works like a charm! The initial loading appears quite a bit slower now but both movement over images and not overlapping over windows are now solved so I'll take the slower initial loads, so closing this! There's still some image overlaps with some text, but that's a different issue and not a huge problem!

20230710-183900

Awesome!

It looms like it still renders at the wrong position, off by one on both x and y.

https://github.com/3rd/image.nvim/commit/c9576783d2eac3594fc6d264001e10bec60444b9 seems to have fixed this!

Could you share a small config & documenr sample to reproduce this? I'd like to fix it. Is it a Neorg file?

Not Neorg, just markdown created in logseq.

About the initial load, it now handles resizing and cropping in two steps, and both are cached.

I'm thinking of dropping magick and making a separate helper with Go to handle all image operations, as well as masking, compositing, and backend communication. Would be testable, have better perf, and will be embeddable in anything, not just Neovim.

that sounds great! the luarocks installation process isn't exactly the easiest go via a proper build.lua https://www.reddit.com/r/neovim/comments/14n5aom/plugin_authors_lazynvim_now_supports_buildlua/ might be a better experience!

3rd commented 1 year ago

Awesome, glad it works! Yeah, wasn't able to do masking with magick and the rock isn't compatible with distros like NixOS.