-
Notifications
You must be signed in to change notification settings - Fork 19
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
Sixel image rendered on the last line of terminal causes a scroll, messes up the whole screen #57
Comments
In theory it should be possible to render a Sixel image on the last line, but you need to limit the height to a multiple of 6 that will fit in the cell height. For example, if your cell height is 20px, you can fit an 18px high Sixel image in that space, but anything more than that is going to round up to a height of 24px, which will trigger a scroll. So if you really want to fill the last line, you'd have to start your image a couple of rows up, so you can use a height that's both a multiple of 6, and a multiple of the cell height. For example, with a cell height of 20px, you can output a 60px image, with the first 40px being transparent. That would exactly span the bottom 3 rows, and shouldn't trigger a scroll. In practice, though, many terminals incorrectly position the text cursor below the image, so they will still trigger a scroll even when the image fits. That's a terminal bug though, and it's worth noting that those terminals will potentially not even be able to fill the second last line of the screen without scrolling. As for You should also be aware that |
Is it possible to just disable scrolling in the terminal with some sort of a control sequence? |
We must render in multiples of the font-size, to avoid stale character artifacts, so we can't really try to do some multiple of six for sixels. So I don't think we can do much about this, the best we can do is put a big fat warning in the readme, and advise to never render an image on the last line of the screen. |
What if we automatically cropped the image to avoid the scrolling? |
We could maybe do that for specifically for sixels, but I would make it configurable, because some users might not need this, for example if the program never renders in the last row because it has a status bar, or always has a border, or something like that. |
If the image is not rendered in the last line it would not crop the image. A config option is not necessary as it can be detected with the library |
I'm not sure if I understand correctly, but I think you mean that the library can detect if we're rendering in the last line of the screen, which I think is not possible. The library renders into a buffer, which might be the screen, or something else. |
But even if the buffer is not the screen, rendering the image beyond the buffers bounds is not the desired behaviour |
But the issue is not rendering beyond the buffer, the issue is rendering into the last line of the buffer (or given area), and the library not possibly knowing whether that last line would be the last line of the screen. |
Then I guess add an .on_last_line method to turn on the feature |
There is
DECSDM
, but this causes the image to be rendered at0,0
no matter what, and the implementations also seem to be wildly different.No idea how to fix it other than not rendering in the last line of the terminal.
The text was updated successfully, but these errors were encountered: