Open definitelynotrazu opened 1 year ago
Image.nvim makes use of unicode placeholders which Konsole doesn't seem to have support for.
I believe the reason for this is to allow for easy image cropping, though 3rd could elaborate more.
Ah we only have experimental support for placeholders, they didn't work great so far, but might be good for animations in statuslines.
I don't know about Konsole, but even WezTerm had issues.
It looks like it does have something: https://invent.kde.org/search?search=kitty&nav_source=navbar&project_id=318&group_id=1556&search_code=true&repository_ref=master
Does the usual kitten icat image.jpeg
work in Konsole?
what do you mean by experimental? I thought that we relied on Unicode placeholders, but I could seem to be wrong. I remember someone had an issue where they were running an old version of Kitty that didn't yet have placeholder support and images weren't rendering in the same way described in this issue (ie. box shows up but no image)
After taking a peek at the code again I see that it's on off by default option.
Yeah, had all kind of issues, it requires filling the term cells at the target position with some characters, and it's pretty finicky. It would work great in a statusline because we can output those characters directly instead of drawing them over.
We send a U=0
when unicode placeholders isn't used.
Just from printing stuff out from the write_graphics
function.
I'm guessing that this is unrecognized by some kitty graphics implementations and throws an error which causes rendering to fail.
so a fix might be to remove that key when the value is 0? I'm not super familiar with kitty graphics though.
I tried removing U=0
and didn't notice any difference, however, I tried running in direct mode (by setting is_SSH = true
) AND using action = transmit_and_display
and it displays in nvim now. Didn't work for me inside TMUX however. Not a solution but a start.
https://github.com/3rd/image.nvim/assets/70285210/7f3dae38-4376-4046-aea4-883cbda9d581
Ah interesting, maybe they only support that. We can add an option to force direct mode, although it should be much slower.
@3rd Here is the U
issue, not sending the U
control char when it's 0 seems like it could allow for older versions of kitty to use this plugin, though I haven't tested. and it might not be worth it
With the current implementation, U
is only specified on display when virtual-placeholders is set, however, it is always specified on transmit (either 1 or 0). My understanding is that it doesn't need to be specified at all on transmit and this line can be removed. The testing I did has it working, however, I'm unsure how to effectively test it. I'm interested to see which versions of kitty this would support.
However, as far as my testing goes, this doesn't actually effect Konsole. I think I've narrowed this down to 2 small changes in order for images to display properly.
t=d
. This is done already when is_SSH
is set, however, I can't think of any clever way to check for whether the emulator is Konsole.z=-1
on display. I can't explain why this works, because my testing directly in the terminal tells me this parameter should work fine in Konsole.Output below shows the return from Konsole when trying to use file-mode t=f
:
EDIT: This only seems to be sometimes working with Konsole...
Changed it to not send U at all if not used.
I'm also interested in getting support in konsole. The minimum edit that I found works for me is to currently to set transmit_medium = codes.control.transmit_medium.direct
and display_zindex=nil
in the lua/image/backends/kitty/init.lua
file.
It might be a transient fix as konsole updates it's unicode placeholder support, but could we implement a switch for various terminal emulators with something like:
local is_konsole = string.find(vim.fn.system("pstree -sA $$"), "konsole")
Firstly thank you for your work on this plugin, especially for the Neorg integration. I was curious about Konsole support, I was under the impression that Konsole is making use of the same protocols as Kitty, the "Terminal graphics protocol" but when I use Konsole the image is invisible. The box shows up, the spacing is there as if an image was rendered, if I make a new line the line is placed under where an image would be but there is no image rendered.
Not sure if this is a bug or if Konsole requires additional support. Hope you perhaps consider this regardless. Thanks