Coder Social home page Coder Social logo

Comments (12)

jerch avatar jerch commented on June 14, 2024 1

Ah just got through the compilation - yupp works with the -pi switch - Thanks alot ❤️ .

from timg.

hzeller avatar hzeller commented on June 14, 2024 1

FYI, this is part of the v1.5.3 release.

That also includes some more detection in the VSCode context, so it automatically switches to iterm graphics in vscode, and also can extract the width and height of a character cell to be able to show animations and columnized output.

from timg.

hzeller avatar hzeller commented on June 14, 2024 1

Yep, the ioctl() first, then fallback query is now exactly how I do it

from timg.

hzeller avatar hzeller commented on June 14, 2024

Should be easy to add, we have the png_size value available right there to include in the sprintf().

The images worked in the tested iterm2, wezterm and konsole terminal; if you have a terminal where you observed this to be not working, it might be useful to add that to the set of terminals to test with.

from timg.

hzeller avatar hzeller commented on June 14, 2024

just tested with sending bogus values to konsole and wezterm and it seems to work fine, i.e. they don't look at that value.

I don't have an iterm2 to test as it is not available on linux. The value is ambiguous: does it mean the raw size or the base64 encoded size ?

from timg.

jerch avatar jerch commented on June 14, 2024

Yeah the parameter is a bit unclear - since it says "file size in bytes" I'd assume it means the real file size, not the size of the base64-encoded content.

Btw vscode's integrated terminal checks against this value to spot data errors and to limit the sequence size. I find it kinda weird that other terminals just let things pass here, smells like an potential DOS vector to me.

from timg.

hzeller avatar hzeller commented on June 14, 2024

so I can test it with vscode ? What do I need to do to reproduce ?

from timg.

jerch avatar jerch commented on June 14, 2024

You'd need vscode 1.80+ version (got recently added), and make sure, that the terminal image support is enabled (it is by default). Then imgcat (https://iterm2.com/utilities/imgcat) should show images via IIP.

To repro - if you omit the size param in the sequence, images will not show up.

from timg.

hzeller avatar hzeller commented on June 14, 2024

Alright, looks like it is the raw image size. Can you do a git pull and test again ?
I tested it the change with vscode terminal.

from timg.

jerch avatar jerch commented on June 14, 2024

A quick one-liner I guess 😸

one sec...

from timg.

hzeller avatar hzeller commented on June 14, 2024

Here is an AppImage to avoid compiling from scratch.

from timg.

jerch avatar jerch commented on June 14, 2024

Sidenote on size ioctls like TIOCGWINSZ:

Its indeed not safe to assume, that the OS implements the pixel notion in its tty/termios abstraction - it is not specced on POSIX side (there a ~5ys old attempt to add that). ConPty/Windows does not implement it (which is partially the reason why vscode terminal relies on those old DEC size sequences). Still all major remaining unix derivates implement the pixel stuff as far as I am aware (at least on Linux/FreeBSD/MacOS/Solaris, no clue about AIX here).
Next obstacle to consider are different ssh libs and whether they transmit these ioctl datapoints (idk, have not checked it).

All in all - the size sequences are a safer bet, although a bit more cumbersome to work with on cmdline appside due the needed message cycling. For best TE+OS coverage prolly check for ioctl first and use the CSI t sequences as a fallback.

from timg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.