Skip to content

Query XTGETTCAP on Terminal init#375

Merged
jquast merged 4 commits into
masterfrom
jq/xtgettcap-improved
May 18, 2026
Merged

Query XTGETTCAP on Terminal init#375
jquast merged 4 commits into
masterfrom
jq/xtgettcap-improved

Conversation

@jquast
Copy link
Copy Markdown
Owner

@jquast jquast commented May 14, 2026

Implement terminal capability discovery via XTGETTCAP (DCS +q).

  • Add TermcapResponse.parse_capabilities(), make_jinxed_capabilities(),
    unescape_terminfo() for ghostty/kitty/foot terminfo-source values.
  • Probe during init for TN, RGB, colors, blink, sitm, ritm, cvvis,
    Smulx, Setulc, Ms. Overlay discovered capabilities onto jinxed.
  • Add get_xtgettcap(caps=...) for selective/incremental capability queries.
  • Detect 24-bit color via COLORTERM and XTGETTCAP RGB/colors.
  • Add number_of_colors XTGETTCAP resolution layers.

@jquast jquast changed the base branch from master to jq/jinxed-2.0 May 14, 2026 03:22
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 14, 2026

Merging this PR will not alter performance

✅ 28 untouched benchmarks


Comparing jq/xtgettcap-improved (43a43a8) with master (2c0576e)

Open in CodSpeed

@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.35%. Comparing base (2c0576e) to head (43a43a8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #375      +/-   ##
==========================================
- Coverage   97.51%   97.35%   -0.16%     
==========================================
  Files          13       13              
  Lines        3706     3785      +79     
  Branches      646      671      +25     
==========================================
+ Hits         3614     3685      +71     
- Misses         70       82      +12     
+ Partials       22       18       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jquast jquast force-pushed the jq/jinxed-2.0 branch 3 times, most recently from 9742d0e to c1bebc3 Compare May 15, 2026 02:06
@jquast jquast changed the title full XTGETTCAP negotiation Query XTGETTCAP on Terminal init May 15, 2026
@jquast jquast force-pushed the jq/xtgettcap-improved branch 2 times, most recently from 2496e62 to 66a3e5a Compare May 15, 2026 03:25
@jquast jquast marked this pull request as ready for review May 15, 2026 03:38
@jquast
Copy link
Copy Markdown
Owner Author

jquast commented May 16, 2026

I have published a draft of utility that uses this feature https://github.com/jquast/ttyscan, it makes good calculated use of new caps= argument for get_xtgettcap()

Base automatically changed from jq/jinxed-2.0 to master May 18, 2026 15:47
An error occurred while trying to automatically change base from jq/jinxed-2.0 to master May 18, 2026 15:47
jquast added 4 commits May 18, 2026 11:50
Implement terminal capability discovery via XTGETTCAP (DCS +q).
Probe during init for TN, RGB, colors, blink, sitm, ritm, cvvis,
Smulx, Setulc, Ms. Overlay discovered capabilities onto jinxed.
Add get_xtgettcap(caps=...) for selective/incremental queries.
Detect 24-bit color via COLORTERM and XTGETTCAP RGB/colors.
Add number_of_colors XTGETTCAP resolution layers.

Add TermcapResponse methods: parse_capabilities, from_match,
unescape_terminfo, make_jinxed_capabilities, hex_encode, hex_decode.
Extract _validate helper in text_sized.
Clip sizing alignment to fractional-scaling-only (Kitty protocol).
Add bin/xtgettcap_compare.py tool.
…moved

The jinxed migration intentionally dropped the %i detection in get_location(),
now unconditionally converting CPR coordinates from 1-based to 0-based.  The
test for a nonstandard u6 without %i is no longer applicable and is redundant
with test_get_location_styling_indifferent.
@jquast jquast force-pushed the jq/xtgettcap-improved branch from 6e3c174 to 43a43a8 Compare May 18, 2026 16:16
@jquast jquast merged commit 88014f5 into master May 18, 2026
15 of 16 checks passed
@jquast jquast deleted the jq/xtgettcap-improved branch May 18, 2026 16:19
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

Successfully merging this pull request may close these issues.

1 participant