Skip to content

Conversation

@zesk1999
Copy link
Contributor

Description

When using the Spy prompt in a terminal, pressing Delete (and other navigation keys) inserted a literal ~ instead of doing the expected action.
This happened because those keys on Linux terminals send a multi-byte sequence like ESC [ 3 ~. Our code read up to the number (which was before not recognized by code) but didn’t consume the final ~, so it got echoed on screen.

Changes introduced in this PR

  • properly consumes the final ~ on Linux for these keys and performs the correct action
  • adds the matching key codes for Windows so behavior is consistent on both platforms (introduces a small file-scoped helper consume_tilde_if_present())

Linux terminal:

ESC [ 2 ~ → Insert: now cleanly ignored
ESC [ 3 ~ → Delete: delete char at cursor
ESC [ 5 ~ → Page Up: previous command in history
ESC [ 6 ~ → Page Down: next command in history / clear if none
ESC [ H → Home: move cursor to start of line
ESC [ F → End: move cursor to end of line

Windows console:

Insert = 82 (ignored)
Delete = 83
Page Up = 73
Page Down = 81
Home = 71
End = 79

@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2025

Codecov Report

❌ Patch coverage is 0% with 54 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.54%. Comparing base (3d51e72) to head (e79d151).

Files with missing lines Patch % Lines
cpp_utils/src/cpp/event/StdinEventHandler.cpp 0.00% 54 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #143      +/-   ##
==========================================
- Coverage   62.45%   60.54%   -1.92%     
==========================================
  Files          65       65              
  Lines        1867     1921      +54     
  Branches      535      543       +8     
==========================================
- Hits         1166     1163       -3     
- Misses        382      438      +56     
- Partials      319      320       +1     

☔ 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.

rsanchez15
rsanchez15 previously approved these changes Sep 25, 2025
@rsanchez15 rsanchez15 merged commit fd0f9f5 into main Sep 25, 2025
15 checks passed
@rsanchez15 rsanchez15 deleted the hotfix/delete-prints-tilde branch September 25, 2025 08:41
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.

4 participants