dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.57k stars 112 forks source link

Notcurses hangs with tmux (if built with sixel support) #2736

Open rockorager opened 11 months ago

rockorager commented 11 months ago

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

dankamongmen commented 11 months ago

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) $ 
rockorager commented 11 months ago

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

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

dankamongmen commented 11 months ago

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

rockorager commented 11 months ago

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

dankamongmen commented 11 months ago

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.

rockorager commented 11 months ago

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

rockorager commented 11 months ago

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 commented 11 months ago

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...

dankamongmen commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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

kmarius commented 7 months ago

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

dankamongmen commented 7 months ago

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

joseluis commented 3 days ago

I think I just hit this issue. While using tmux 3.4 notcurses doesn't work at all. I.e. notcurses-info hangs before outputting a single character, and have to sigint it.

joseluis commented 12 hours ago

Linking the conversation in the tmux repo for reference: https://github.com/tmux/tmux/issues/3727