Closed srlehn closed 5 years ago
Thanks. Can you confirm that lsix works with MinTTY?
Hi. The positioning seems to be off:
The image appeared near the top and the next prompt was printed over it.
Yeesh. That's the third terminal that copied the sixel scroll bug. I can work around it. What does MinTTY set the TERM environment variable to?
mintty and WSLTty (based on mintty) are from the same author - I am not aware of terminal specific differences. Both of them can probably be handled the same.
mintty has TERM set to xterm... When it is run as the Cygwin Terminal it has an icon set and the environment variable MINTTY_SHORTCUT is set and can be checked in this case.
It probably is better to check if the terminal is an actual xterm based on if the variable XTERM_VERSION is set not if TERM == xterm.
Yeesh. That's the third terminal that copied the sixel scroll bug. I can work around it. What does MinTTY set the TERM environment variable to?
I think xterm has the buggy behaviour here (https://github.com/mintty/mintty/issues/572#issuecomment-236396598) (I didn't read the whole PR):
Still not like xterm (which moves to the horizontal beginning of the line, not of the image), but note http://vt100.net/docs/vt3xx-gp/chapter14.html :
When sixel display mode is enabled, the sixel active position begins at the upper-left corner of the ANSI text active position. Scrolling occurs when the sixel active position reaches the bottom margin of the graphics page. When sixel mode is exited, the text cursor is set to the current sixel cursor position.
So actually your previous approach was the original one and xterm does not implement it correctly. I guess we should follow DEC here rather than xterm. This applies to "Sixel Scrolling Mode Enabled"; "Sixel Scrolling Mode Disabled" does not seem very useful to me.
https://github.com/mintty/mintty/issues/572#issuecomment-236438360
Tera Term maintainer @ttdoda, also known as VT collector, reported real behavior of SIXEL terminal VT382 and VT330.
He says, (summary)
In VT382, the cursor returns to left automatically, in spite of lacking sixel next line charactor(-) at the end of SIXEL dump. (twitter) A SIXEL line has only 6-dot height, and the text line is higher than it. Because SIXEL active position is converted into text cursor position, it might not be at next line of bottom, but at the bottom-left corner of image. (twitter)
I think we should follow Xterm's behavior because it is too complicated to emulate.
It is a bug in MinTTY if it sets the TERM variable to xterm and is not bug-for-bug compatible with xterm. MinTTY should add their entry to the TERMINFO database instead of pretending to be something else.
As for the positioning of the text after showing an image, I'm pretty sure what you quoted actually shows that Xterm is doing the right thing (putting the text after the image instead of on top of it). What MinTTY and mlterm appear to be emulating is a VT125 or VT240, a behavior specifically deprecated in the DEC literature as deviant. Please see DEC STD 070, chapter 9, section 12.1, Deviations.
There are so many terminals pretending to be xterm - I think all libvte based ones use xterm or xterm-256color, alacritty uses xterm-256color. tmux pretends to be screen with the TERM variable. It doesn't matter what TERM should be practically all terminal emulators I know of abuse it. You can't use TERM to decide what terminal you are using. It reminds me of the User Agent Mozilla/5.0.
I can't say much about the expected terminal behaviour for sixel graphics. Most of what I know was found by testing when making sixel output work for a specific terminal emulator/multiplexer. I am more interested in having my program work than fulfilling all those slightly antique standards. If possible and I know how it should behave and the supposed bahaviour doesn't conflict with the real behaviour of terminals I of cause will follow the rules.
Thanks for the pdf link. Here the excerpt: https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n929 page: 930-931
It is precisely the USER AGENT problem which MinTTY is contributing to by not using its right name. UNIX has had a solution to this for a long time: using Terminfo, a terminal can use its own name but simply declare that it is compatible with some other terminal.
MinTTY is written as mintty since 2009 (https://groups.google.com/forum/#!msg/mintty-discuss/Qb_88RMRy-o/NUfct8j9dl8J).