-
Notifications
You must be signed in to change notification settings - Fork 5
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
How does the background select really work? #5
Comments
It just occurred to me that you can't exactly cut and paste these examples into the VT340. I'm assuming it'll be easier to test with a simple shell script that runs them one by one.
|
The github website gave me a textarea form I could fill in that I thought was for the response, but on the VT340 I couldn't tell I was actually editing your comment! Hah! ☺ Anyhow, the answer is "No" to the first two and "Yes" to all the rest. |
Thanks for testing that. That makes sense. I guess it waits for either the first sixel to be ouput, or the end of the image. |
Although now that I think about it, that doesn't explain the second test. If it was going to fill anything, I would have expected it to be limited to the 400x240 size, i.e. a quarter of the screen. So that is a bit strange. |
I put a sleep in the first test and it seems to clear the screen when the first byte after q is received. (I didn't send the backslash for five seconds). It's possible there is some byte which it would not clear the screen for, but I'm not sure what. |
Oh, duh. Of course, it's waiting for DECGRA. So a double quote after the q does not clear the screen. |
For the second test, it clears the screen unless there is some sixel data. For example, this clears the top left corner (as soon as it receives the escape character):
This clears the upperleft corner when it receives the letter 'a':
|
I think clearing the whole screen when there is no sixel data is a bug as the following should be equivalent, but correctly clears just the top left corner:
[UPDATE: new test cases show that the second DECGRA is ignored unless there is sixel data] This clears a 400x240 square:
This clears a 200x120 square:
This clears a 100x60 square:
I'm not sure what makes it sometimes work . A single hashmark (with no color number) works, which rules out my theory that the entire screen was clearing as a sign that the sixel data was malformed. Semicolons and numbers don't, so perhaps it is simply any token that takes the VT340's finite state machine out of the initial "getting sixel metadata" state. |
This is getting really interesting. It didn't even occur to me until now that you could set DECGRA more than once.
Yeah, that seems like a reasonable theory. |
Speaking of weird finite state machine things, maybe I'm just tired, but I don't understand how my VT340 seems to know to get out of sixel mode when I get back to the prompt when I don't send the String Terminator.
[time passes...] Okay, I just put the VT340 into "Show Control Characters" mode (instead of "Interpret") and I can see that my shell (bash) is sending This seems like an important quirk to test and document for VT340 sixel compatibility. It actually makes experimenting with sixels much nicer because I haven't been getting stuck in sixel mode with no clear visual indication of what's going on. |
I've been playing around with this on my own Sixel implementation, and the VT340 behavior seems reasonably sensible in retrospect. Sixel commands don't have a specific separator indicating where the command ends, so you generally execute a pending command when you encounter the start of the next command, or when you receive a sixel byte. Originally I would also execute any pending commands when the end of the image was reached (i.e. the There is a catch, though. I don't think this rule applies to
Technically I think the ANSI/ECMA specs require that a That said, none of the open source terminal emulators handle progressive output (at least that I'm aware of), and many of them do actually abort the image if it's not terminated with an
Yeah, it's definitely worth testing, but I didn't think there was much doubt about the behavior, and initially I've been concentrating on testing the edge cases for which there wasn't any clear documentation. Then again, I've frequently been wrong about VT340 behavior which I thought I understood perfectly. |
I hadn't known that those characters could stand in for |
FYI, I've included a test for different string terminators in PR #8. That test also checks what happens when you embed other control characters and unexpected command/parameter characters in the control string. |
Results are in unexpected.png. Note that the backwards question mark is the VT340 way of indicating an unknown character. |
Yeah, I was expecting the reverse question mark. The normal question mark at the end of the test pattern was to try and balance that out (the idea being that it should look reasonably symmetric if it was working correctly). I wasn't expecting it to be quite that large, but that's not the end of the world. I am surprised that all the squares are gray though. They were meant to be kind of chequered pattern with various shades of yellow and gray. Is it possible you ran the test when the palette was set to monochrome? If the test had actually "failed", I would expected more corruption of the shape, and at least some sign of color. |
Bizarrely, that is exactly what displays on the screen. I tried it again and, during MediaCopy command, most of the colors got switched to
If that palette is replaced with the default one, the image shows up exactly as you expected. I double-checked and my mediacopy.sh script is requesting a color print. I did notice I had left it creating a transparent image ("no background"), but that shouldn't have affected the palette. I'm rerunning the script and will let you know if I figure out where the glitch is. |
No idea what went wrong before. This time it worked. I had a suspicion it was glitching because of background transparency, but that doesn't seem to be it. Another possibility is that one of my experiments had left MediaCopy printing images in HLS instead of RGB, but that doesn't seem to meet the fact that the broken output definitely uses RGB. (Unless... I wonder if Level 2 HLS printing is broken on the VT340. I'll have to test that some time.) |
That's brilliant, thanks. I was a bit worried it had something to do with my choice of color scheme. 😊 But getting back to our earlier discussion of For example, consider this sequence:
It's starting with a 20:1 aspect ratio and a size of 60x60. That's followed by a We then have another In short, do we get a 10x6 block with a 240x240 background fill that is 6 rows down, or is it a 10x120 block, or something else entirely? |
A 10x6 block with a 240x240 background fill that is 6 rows down. |
That's actually kind of useful I think. It gives you a way to position images on the screen in Sixel Display Mode in a reasonably efficient manner. For example, if you wanted to position an image 18 rows down, you don't have to output 60 I think it might be worth creating another test that demos some of the edge cases involving multiple |
FYI, I think you accidentally deleted |
From the results we've got so far in the margin_clipping and raster_dimensions tests, I know there are some aspects of the background select that I've got wrong, but I'm still not completely sure what the correct behavior is. So before I make any more adjustments to those tests, I'll like to try and get a better understanding of the edge cases.
To start with, it looks to me like the VT340 only starts filling the background once you've output at least one pixel. So my first question is, what happens if the sequence didn't include any sixels at all? Would it just have no effect and not output anything, i.e. in these two tests, would you just get a screen that is filled with E's?
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq\033\\n'
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq"1;1;400;240\033\\n'
And if that's the case, what does is take for the background select to kick in? Is a 'zero' sixel enough (i.e. ?), or would you need at least one non-zero sixel (e.g. @)? Do both of these tests fill the screen with black?
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq?\033\\n'
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq#0@\033\\n'
And testing with an explicit raster size, do both of these fill the top left quarter in black?
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq"1;1;400;240?\033\\n'
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq"1;1;400;240#0@\033\\n'
Another thing implied by the current results is that a graphic new line wouldn't be enough to trigger the start of the background fill. If that's correct, then I'd expect only the bottom half of the screen to be filled with black in these next two cases. Is that correct?
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033P2q--------?\033\\n'
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033P2q--------#0@\033\\n'
And testing with an explicit raster size, I'd expect these two to fill the middle left portion of the screen (rows 6 to 17, columns 0 to 39).
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq"5;1;400;240----?\033\\n'
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq"5;1;400;240----#0@\033\\n'
Another area I'm unsure of is the handling of the zero and omitted parameters in the raster size definition. Contrary to what the DEC STD-070 documentation says, my understanding is that both zero and omitted parameters are treated as representing the maximum extent (rather than 1). If that is correct, then the two examples below should fill the top half of the screen (given an explicit height, but default width).
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq"1;1;;240?\033\\n'
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq"1;1;0;240?\033\\n'
And these two should fill the left half of the screen (given an explicit width, but default height).
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq"1;1;400?\033\\n'
printf '\033[H\033[?7h';yes E|tr -d '\n'|head -c 1920;printf '\033[H\033Pq"1;1;400;0?\033\\n'
I'm not expecting you to screenshot all of these - I'm just looking for confirmation whether they are or aren't filling the screen in the way I expect. Once I think I know what's going on, I'll try and update my main test cases to take these results into account.
The text was updated successfully, but these errors were encountered: