notcurses icon indicating copy to clipboard operation
notcurses copied to clipboard

Notcurses hangs with tmux (if built with sixel support)

Open rockorager opened this issue 1 year ago • 18 comments

tmux recently added sixel support, and in doing so modified their DA1 response from CSI ? 1 ; 2 c to CSI ? 1 ; 2 ; 4 c. In this build, notcurses hangs (ie notcurses-info hangs). I assume this is an issue with the DA1 parser. the xterm ctlseqs docs don't show that a CSI ? 1 ; 2 c response can have param, but the VT220 manual sure seems to imply that a DA1 response can consist of any number of params.

$ export | egrep 'LANG|LC_CTYPE|TERM'
COLORTERM truecolor
GDM_LANG en_US.UTF-8
LANG en_US.UTF-8
TERM foot

nc version 3.0.9

foot 1.16.2

tmux next-3.4 (built off master branch) tmux TERM tmux-256color

rockorager avatar Oct 28 '23 14:10 rockorager

thanks for letting me know about this! this seems pretty serious. do you know which version of tmux added support? notcurses-info seems to work in tmux within kitty using tmux 3.3a:

[schwarzgerat](1) $ tmux -V
tmux 3.3a
[schwarzgerat](0) $ 

dankamongmen avatar Oct 28 '23 14:10 dankamongmen

It's not released yet, but will be version 3.4

https://github.com/tmux/tmux/commit/dfbc6b1888c110cf0ade66f20188c57757ee1298

rockorager avatar Oct 28 '23 15:10 rockorager

oh great, maybe we can stay ahead of it; that would be sweet

dankamongmen avatar Oct 28 '23 15:10 dankamongmen

Also FYI, they did not implement a response to XTSMGRAPHICS, but are open to a PR

rockorager avatar Oct 28 '23 15:10 rockorager

Also FYI, they did not implement a response to XTSMGRAPHICS, but are open to a PR

that's kinda weird. if you're not opposed to the idea, it's a pretty simple thing to do afaik. i'm currently readying my first novel for publication, on top of a pretty intense (this year) day job, and probably will not be writing tmux code personally, especially as i don't use it. but i wholeheartedly encourage someone else to do so!

which, hrmmm, i guess i just answered my own question from above.

dankamongmen avatar Oct 28 '23 15:10 dankamongmen

Hmm, unfortunately they seem to unilaterally respond with sixel support, regardless of the underlying terminal's support

rockorager avatar Oct 28 '23 15:10 rockorager

that's kinda weird. if you're not opposed to the idea, it's a pretty simple thing to do afaik. i'm currently readying my first novel for publication, on top of a pretty intense (this year) day job, and probably will not be writing tmux code personally, especially as i don't use it. but i wholeheartedly encourage someone else to do so!

Sorry, I didn't mean to imply you need to fix it :). I don't have plans to do it currently but added it to a "someday, maybe" list.

rockorager avatar Oct 28 '23 15:10 rockorager

Ok with tmux responding unilaterally with sixel support, notcurses will be broken on non-sixel terminals. The output you get is this:

SIXEL IMAGE (49x16)++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++

I think they should instead respond without sixel support if the underlying terminal doesn't have it, so that at east notcurses can fall back to a sex/quad blitter. I think I'll make a new issue over there about that...

rockorager avatar Oct 28 '23 15:10 rockorager

Ok with tmux responding unilaterally with sixel support, notcurses will be broken on non-sixel terminals. The output you get is this:

SIXEL IMAGE (49x16)++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++

I think they should instead respond without sixel support if the underlying terminal doesn't have it, so that at east notcurses can fall back to a sex/quad blitter. I think I'll make a new issue over there about that...

yeah if the sixel can't be displayed, they ought not indicate support. ideally they would query the terminal with XTSMGRAPHICS on startup/connection. what happens if you connect to a running tmux with two different terminal types? is that just unadvised?

dankamongmen avatar Oct 28 '23 17:10 dankamongmen

Sorry, I didn't mean to imply you need to fix it :). I don't have plans to do it currently but added it to a "someday, maybe" list.

oh you didn't; i just want to fix things by default lol

dankamongmen avatar Oct 28 '23 17:10 dankamongmen

note that this fucks anything using XTSMGRAPHICS and expecting it to reflect the real universe, not just notcurses

dankamongmen avatar Oct 28 '23 17:10 dankamongmen

Archlinux is shipping tmux 3.4 with sixel support as of last week and I am now hitting this issue.

kmarius avatar Feb 19 '24 10:02 kmarius

i'll look into this ASAP. thanks for bumping it, @kmarius .

dankamongmen avatar Feb 20 '24 07:02 dankamongmen