Skip to content
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

Investigate issues w. screen #16

Closed
bash opened this issue May 16, 2024 · 1 comment
Closed

Investigate issues w. screen #16

bash opened this issue May 16, 2024 · 1 comment

Comments

@bash
Copy link
Owner

bash commented May 16, 2024

Bug report in delta: dandavison/delta#1707

Notes

  • Sending OSC 10 ; ? + DA1 returns just the response to DA1:
    printf '\e]10;?\e\\\e[c'
    e[c^C
  • Sending OSC 11 ; ? + DA1 returns the DA1 response followed by OSC 11. This breaks a core assumption that the order of sequences is respected!
@bash
Copy link
Owner Author

bash commented May 18, 2024

Fixed in https://github.com/bash/terminal-colorsaurus/releases/tag/0.4.1 by detecting and bailing out early for screen.

Context:

// Why is GNU Screen unsupported?
//
// 1. Screen only supports `OSC 11` (background) and not `OSC 10` (foreground)
//
// 2. Screen replies to queries in the incorrect order.
// We send `OSC 11` + `DA1` and expect the answers to also be in that order.
// However, as far as I can tell, Screen relays the `OSC 11` query to the underlying terminal,
// and so we get the `DA1` response back *first*. This is usually an indicator that
// the terminal doesn't support the `OSC` query.
//
// There are two both equally broken workarounds:
//
// * Don't send `DA1`, just `OSC 11`. \
// Since Screen forwards the query to the underlying terminal, we won't get an answer
// if the underlying terminal doesn't support it. And we don't have a way to detect that
// => we hit the 1s timeout :/
//
// * Send the query (`OSC 11` + `DA1`) to the underlying terminal by wrapping it between `CSI P` and `ST`.
// (There's a reverted commit that does exactly this: f06206b53d2499e95627ef29e5e35278209725db)
// * If there's exactly one attached display (underlying terminal)
// => everything works as usual.
// * If there's no attached display we don't get an answer to DA1
// => we hit the 1s timeout :/
// * If there are multiple displays attached (yes this is supported and quite fun to try) we get back multiple responses
// => since there's no way to know that we need to expect multiple responses
// some of them are not consumed by us and end up on the user's screen :/

@bash bash closed this as completed May 18, 2024
bash added a commit to bash/delta that referenced this issue May 18, 2024
> * 🐛 Fixed `OSC 11` response being visible to users of GNU Screen
     by detecting Screen and erroring before sending any control sequences (bash/terminal-colorsaurus#16).
bash added a commit to bash/bat that referenced this issue May 18, 2024
> * 🐛 Fixed `OSC 11` response being visible to users of GNU Screen
     by detecting Screen and erroring before sending any control sequences (bash/terminal-colorsaurus#16).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant