dnkl/foot
41
2.0k
Fork
You've already forked foot
243

XTGETTCAP does not advertise osc 52 #2127

Closed
opened 2025年06月02日 21:12:43 +02:00 by AtomToast · 2 comments

Foot Version

foot version: 1.22.3 +pgo +ime +graphemes -assertions

TERM environment variable

foot

Compositor Version

river 0.4.0-dev.64+46f77f3

Distribution

Arch Linux

Terminal multiplexer

Shell, TUI, application

zsh, neovim

Server/standalone mode

  • Standalone
  • Server

Foot config

[main]
font=Hack Nerd Font:size=11,JoyPixels:size=11
pad=3x0 center
[colors]
regular0=282828
regular1=cc241d
regular2=98971a
regular3=d79921
regular4=458588
regular5=b16286
regular6=689d6a
regular7=a89984
bright0=928374
bright1=fb4934
bright2=b8bb26
bright3=fabd2f
bright4=83a598
bright5=d3869b
bright6=8ec07c
bright7=ebdbb2
foreground=ebdbb2
background=282828
alpha=0.98
[key-bindings]
spawn-terminal=Control+Shift+Return
show-urls-launch=Control+Shift+u
show-urls-copy=Control+Shift+l
unicode-input=Control+Shift+q
[url]
label-letters=tnseriaoplfuwydhvmck
[url-bindings]
toggle-url-visible=j

Description of Bug and Steps to Reproduce

When ssh'ing neovim should be able to automatically detect and activate osc52 as a clipboard provider. However this does not appear to work in foot.
When manually setting `vim.g.clipboard=osc52' it does work.

My issue matches the problem discussed in this issue: https://github.com/neovim/neovim/issues/29504
According to which you should execute printf '\x1bP+q4D73\x1b\\' in order to query XTGETTCAP. The expected result should resemble P1+r4D73=5C455D35323B25703125733B25703225735C303037.
The returned string from inside foot is P+q4D73.

In the linked issue, the problem ends up being iterm2 misreporting P0+r which apparently indicates that it doesn't support osc 52. Now I know very little about XTGETTCAP and don't actually know what these magic letters represent, so please excuse if I am wildly off here, but my best guess is that the foot string doesn't advertise foots osc 52 capability either. This seems to be not an uncommon issue since there are also matching issues referenced for windows terminal and zellij

Relevant logs, stacktraces, etc.

No response

### Foot Version foot version: 1.22.3 +pgo +ime +graphemes -assertions ### TERM environment variable foot ### Compositor Version river 0.4.0-dev.64+46f77f3 ### Distribution Arch Linux ### Terminal multiplexer - ### Shell, TUI, application zsh, neovim ### Server/standalone mode - [x] Standalone - [x] Server ### Foot config ```ini [main] font=Hack Nerd Font:size=11,JoyPixels:size=11 pad=3x0 center [colors] regular0=282828 regular1=cc241d regular2=98971a regular3=d79921 regular4=458588 regular5=b16286 regular6=689d6a regular7=a89984 bright0=928374 bright1=fb4934 bright2=b8bb26 bright3=fabd2f bright4=83a598 bright5=d3869b bright6=8ec07c bright7=ebdbb2 foreground=ebdbb2 background=282828 alpha=0.98 [key-bindings] spawn-terminal=Control+Shift+Return show-urls-launch=Control+Shift+u show-urls-copy=Control+Shift+l unicode-input=Control+Shift+q [url] label-letters=tnseriaoplfuwydhvmck [url-bindings] toggle-url-visible=j ``` ### Description of Bug and Steps to Reproduce When ssh'ing neovim should be able to automatically detect and activate osc52 as a clipboard provider. However this does not appear to work in foot. When manually setting `vim.g.clipboard=osc52' it does work. My issue matches the problem discussed in this issue: https://github.com/neovim/neovim/issues/29504 According to which you should execute `printf '\x1bP+q4D73\x1b\\'` in order to query XTGETTCAP. The expected result should resemble `P1+r4D73=5C455D35323B25703125733B25703225735C303037`. The returned string from inside foot is `P+q4D73`. In the linked issue, the problem ends up being iterm2 misreporting `P0+r` which apparently indicates that it doesn't support osc 52. Now I know very little about XTGETTCAP and don't actually know what these magic letters represent, so please excuse if I am wildly off here, but my best guess is that the foot string doesn't advertise foots osc 52 capability either. This seems to be not an uncommon issue since there are also matching issues referenced for windows terminal and zellij ### Relevant logs, stacktraces, etc. _No response_

foot does advertise the capability, but the response format is different:

$ printf '\x1bP+q4D73\x1b\\'; cat -v
^[P1+r4D73=1B5D35323B25703125733B25703225731B5C^[\
$ python
>>> [bytes.fromhex(s) for s in "4D73=1B5D35323B25703125733B25703225731B5C".split("=")]
[b'Ms', b'\x1b]52;%p1%s;%p2%s\x1b\\']

compared to the response you mentioned is expected by Neovim:

>>> [bytes.fromhex(s) for s in "4D73=5C455D35323B25703125733B25703225735C303037".split("=")]
[b'Ms', b'\\E]52;%p1%s;%p2%s\007円']

so that's \\E (two characters) instead of the raw escape byte (\x1b), and an (escaped) alternative sequence terminator instead of \x1b\\. This is what kitty sends.

The difference in output format is odd but as far as I can tell, apps should probably ignore the value part (after the =) and only check whether the response is successful or not -- since I don't think there is a reason for any terminal to use a different sequence.

foot does advertise the capability, but the response format is different: ``` $ printf '\x1bP+q4D73\x1b\\'; cat -v ^[P1+r4D73=1B5D35323B25703125733B25703225731B5C^[\ $ python >>> [bytes.fromhex(s) for s in "4D73=1B5D35323B25703125733B25703225731B5C".split("=")] [b'Ms', b'\x1b]52;%p1%s;%p2%s\x1b\\'] ``` compared to the response you mentioned is expected by Neovim: ``` >>> [bytes.fromhex(s) for s in "4D73=5C455D35323B25703125733B25703225735C303037".split("=")] [b'Ms', b'\\E]52;%p1%s;%p2%s\007円'] ``` so that's `\\E` (two characters) instead of the raw escape byte (`\x1b`), and an (escaped) alternative sequence terminator instead of `\x1b\\`. This is what kitty sends. The difference in output format is odd but as far as I can tell, apps should probably ignore the value part (after the `=`) and only check whether the response is successful or not -- since I don't think there is a reason for any terminal to use a different sequence.
Owner
Copy link

Relevant issue behind the change in foot: #1701, and the corresponding PR: #1703

Relevant issue behind the change in foot: https://codeberg.org/dnkl/foot/issues/1701, and the corresponding PR: https://codeberg.org/dnkl/foot/pulls/1703
dnkl 2025年06月03日 06:56:58 +02:00
Sign in to join this conversation.
No Branch/Tag specified
master
osc-5522
sixel-heap-buffer-overflow
releases/1.27
releases/1.26
releases/1.25
releases/1.24
multi-cursor
releases/1.23
pixman-16f-2
releases/1.22
releases/1.21
releases/1.20
releases/1.19
releases/1.18
releases/1.17
releases/1.16
releases/1.15
releases/1.14
releases/1.13
releases/1.12
releases/1.11
releases/1.10
releases/1.9
releases/1.8
releases/1.7
releases/1.6
releases/1.5
releases/1.4
releases/1.3
releases/1.2
releases/1.1
releases/1.0
1.27.0
1.26.1
1.26.0
1.25.0
1.24.0
1.23.1
1.23.0
1.22.3
1.22.2
1.22.1
1.22.0
1.21.0
1.20.2
1.20.1
1.20.0
1.19.0
1.18.1
1.18.0
1.17.2
1.17.1
1.17.0
1.16.2
1.16.1
1.16.0
1.15.3
1.15.2
1.15.1
1.15.0
1.14.0
1.13.1
1.13.0
1.12.1
1.12.0
1.11.0
1.10.3
1.10.2
1.10.1
1.10.0
1.9.2
1.9.1
1.9.0
1.8.2
1.8.1
1.8.0
1.7.2
1.7.1
1.7.0
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.4
1.5.3
1.5.2
1.5.1
1.5.0
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.0
1.2.3
1.2.2
1.2.1
1.2.0
1.1.0
1.0.0
0.9.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/foot#2127
Reference in a new issue
dnkl/foot
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?