This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tymux-10-quiet-head
in repository terminology.
View the commit online.
commit 3bc1413fd44a1e39ece55e7d9946daac95cdbe42
Author: Boris Faure <[email protected]>
AuthorDate: Sat Nov 14 10:59:39 2026 +0000
termptystatus: answer OSC 7501 feature detection
A program probes for support with a body that is a lone question mark
once trimmed. Answer with the fixed reply from the spec's example,
listing the states and kinds this build understands, always terminated
with ESC \. The reply comes last so Terminology only advertises the
feature now that it shows something; reports sent without asking are
stored either way, as revision 0.3 allows.
A question mark inside a report, as in "?x", is a malformed pair with
no state: ignored as before, with no reply.
https://superlogical.com/rex/docs/build/program-status
---
src/bin/termptystatus.c | 19 +++++++++++++++++++
tests/osc-7501-query.sh | 17 +++++++++++++++++
tests/tests.results | 1 +
3 files changed, 37 insertions(+)
diff --git a/src/bin/termptystatus.c b/src/bin/termptystatus.c
index aeee6b26..c799098a 100644
--- a/src/bin/termptystatus.c
+++ b/src/bin/termptystatus.c
@@ -478,6 +478,25 @@ termpty_program_status_handle(Termpty *ty, const Eina_Unicode *body)
if (!body || !*body)
return;
+ /* feature detection: the whole body, once trimmed, is a question mark.
+ * The lists are the ones from the spec's example, and are fixed there */
+ p = body;
+ while ((*p == ' ') || (*p == '\t'))
+ p++;
+ if (*p == '?')
+ {
+ p++;
+ while ((*p == ' ') || (*p == '\t'))
+ p++;
+ if (!*p)
+ {
+ TERMPTY_WRITE_STR("\033]7501;? : states=idle,working,done,"
+ "blocked,error : kinds=permission,question,"
+ "auth\033\\");
+ return;
+ }
+ }
+
/* the payload grammar is bytes; a codepoint above 0x7f makes its
* pair fail the value check, and so is skipped */
for (p = body; *p; p++)
diff --git a/tests/osc-7501-query.sh b/tests/osc-7501-query.sh
new file mode 100755
index 00000000..c36386c2
--- /dev/null
+++ b/tests/osc-7501-query.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# shellcheck source=tests/utils.sh
+. "$(dirname "$0")/utils.sh"
+
+# feature detection: a lone question mark gets the fixed reply,
+# whatever the terminator
+printf '\033]7501;?\033\\'
+printf '\033]7501;?\007'
+# whitespace around the question mark changes nothing
+printf '\033]7501; ? \033\\'
+printf '\033]7501;\t?\t\033\\'
+# a question mark inside a report is a malformed pair with no state:
+# ignored, no reply
+printf '\033]7501;?x\033\\'
+printf '\033]7501;??\033\\'
+# a report after the query still applies
+printf '\033]7501;state=working:progress=50\033\\'
diff --git a/tests/tests.results b/tests/tests.results
index b4023ef4..8a6ddbfa 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -157,6 +157,7 @@ osc-99-occasion.sh f66bc070f39a87a6884b14ad15df76d9
osc-7501.sh 34fdeb17e8ea39728064333158a99b1c
osc-7501-invalid.sh 535a4caa2aa67567dea2ef8e6dd1b4b8
osc-7501-records.sh ec08355a7953bf1017681ddb71f84aa9
+osc-7501-query.sh e4abb61ce4656d5508858e5c737711ca
osc-colors-ris.sh ae9b8008e2cb1fa2bae13a471c90733f
osc-110-112.sh 318a0f4da4b07567353e057bb2de5b2b
osc-colors-st.sh 84636d0d4589573e1e9b3c0fcceb2091
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.