Skip to content

CPR_RESPONSE and coordinate capture with inkey(capture_cpr=True)#369

Merged
jquast merged 17 commits intomasterfrom
jq/cpr-responses-as-keystrokes
Apr 17, 2026
Merged

CPR_RESPONSE and coordinate capture with inkey(capture_cpr=True)#369
jquast merged 17 commits intomasterfrom
jq/cpr-responses-as-keystrokes

Conversation

@jquast
Copy link
Copy Markdown
Owner

@jquast jquast commented Apr 12, 2026

Closes #367

Parse for new Keystroke of name CPR_RESPONSE and attributes cpr_yx and cpr_xy. This allows inkey() to capture the response for Cursor Position Report asynchronously.

New argument to inkey(capture_cpr=False) continues to match "legacy CSI Modifiers" for the F3 key as KEY_SHIFT_F3 et al, but, when set True, always matches as KEY_CPR_RESPONSE.

New example programs,

  • bin/cpr-every-pos.py an exhaustive integration test
  • bin/cpr-async.py provides an asynchronous example

@jquast jquast changed the title Interpret CPR responses as keystrokes Interpret CPR responses as keystrokes (DRAFT) Apr 12, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 12, 2026

Merging this PR will not alter performance

✅ 28 untouched benchmarks


Comparing jq/cpr-responses-as-keystrokes (2198284) with master (663c80b)

Open in CodSpeed

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.44%. Comparing base (663c80b) to head (2198284).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #369      +/-   ##
==========================================
+ Coverage   97.43%   97.44%   +0.01%     
==========================================
  Files          13       13              
  Lines        3619     3640      +21     
  Branches      626      630       +4     
==========================================
+ Hits         3526     3547      +21     
  Misses         71       71              
  Partials       22       22              

☔ 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 changed the title Interpret CPR responses as keystrokes (DRAFT) New CPR_RESPONSE keystroke and coordinate capture with inkey(capture_cpr=True) Apr 17, 2026
@jquast jquast changed the title New CPR_RESPONSE keystroke and coordinate capture with inkey(capture_cpr=True) CPR_RESPONSE and coordinate capture with inkey(capture_cpr=True) Apr 17, 2026
@jquast jquast marked this pull request as ready for review April 17, 2026 21:29
@jquast jquast merged commit ab1b0be into master Apr 17, 2026
16 checks passed
@jquast jquast deleted the jq/cpr-responses-as-keystrokes branch April 17, 2026 21:34
@vxgmichel
Copy link
Copy Markdown

The capture_cpr argument is a nice addition, thanks 🎉

@jquast
Copy link
Copy Markdown
Owner Author

jquast commented Apr 19, 2026

I will release soon, but need to first release jquast/wcwidth#213 and then I will include #368 with it in this next release

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.

CPR responses are reported as separated keystrokes

2 participants