-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Terminal shows SOH and STX characters in Ruby's pry
for some reason
#10786
Comments
Another interesting thing, is in cases where the Terminal viewport is too small, the characters that get displayed are different: ( ^A^B^A^BModule.methods^A^B^A^B: constants nesting used_modules
^A^B^A^BModule#methods^A^B^A^B:
<
<=
<=>
==
===
>
>=
alias_method
ancestors
attr
attr_accessor
attr_reader
attr_writer
autoload
autoload?
class_eval
class_exec
class_variable_defined?
class_variable_get
class_variable_set
class_variables
const_defined?
const_get
const_missing
const_set
const_source_location
constants |
Does this repro in the vintage console host? I forget what the actual right behavior for SOH and STX are - I'd assume that we should just be eating those and doing nothing with them, but maybe they're getting stuck in the conpty buffer then getting round-tripped as U+FFFD. I haven't had enough coffee to remember - Usually @j4james is my expert on these things. |
If we want to match the original DEC terminals, we should technically be eating most of the control characters which don't have defined behaviour, exactly like we do with In a perfect world, I'd eventually like for us to have different compatibility modes, so you could choose between things like strict VT, legacy ANSI.COM, or XTerm compatibility. In the meantime, though, I thought our current behavior was a reasonable compromise. We implement most of the controls that have defined meaning, but output those that aren't typically used in VT apps, so we still have a certain amount of legacy support. But I don't have a strong opinion on this either way. If we decide we want to be strictly VT-compatible in this regard, I'd be happy to write a PR for it. Just be aware that it might trigger more bug reports from people running legacy apps. |
@zadjii-msft I wish I could tell you, but I can't run WSL in the Legacy Console: Unless you meant, just running the whole thing in |
@j4james Though I am not a contributor to Terminal, I think the approach of Compatibility Modes is a sound idea; I believe it's what other Terminal Emulators like iTerm2 do. |
We will probably want to ignore more and more control characters that we can't do anything meaningful with when VT mode is enabled. Apps usually¹ opt in to this, so they can be coerced into behaving. pry/pry@97be53b introduced It looks like they wrap color escapes in ¹ Of course, Terminal enables it by default. We likely do need some measure of "compatibility modes" like @j4james suggests. |
the upstream bug is pry/pry#2185, though, we'll likely want to address this on our own.
2: any vt-like mode. I don't think pure VT vs xterm vs whatever mode is going to affect this one in the future. |
Well the mode I had in mind that would be affected by this is what is usually referred to as ANSIBBS, which is based on the old DOS ANSI.SYS driver with a few extensions. It's what you'd need if you want to access a BBS (they still exist, just via telnet). You can get by with a pure VT emulator, but a lot of stuff won't look right. And a key requirement is using codepage 437, and having access to the C0 range as printable characters (for things like the card suites). Obviously not going to happen anytime soon, but I'm hoping it might be feasible one day. |
When the fix for this issue will be applied? |
Whenever someone writes the code 😜 If you'd like to contribute the fix yourself, I can try and help walk you through where I'd start. I'm pretty sure we should be able to just eat them in AdaptDispatch (somewhere) |
FYI, I've got a PR for this, which I'll hopefully submit later tonight. |
On a real VT terminal, most of the control characters that don't do anything are supposed to be filtered out, and not written to the buffer. Up to to now, though, we've only been filtering out `NUL`. This PR extends our control processing to filter the remaining characters that aren't supposed to be displayed. We introduced filtering for the `NUL` control in PR #3015. The are two special cases worth mentioning. 1. The `SUB` control's main purpose is to the cancel a control sequence that is in progress, but it also needs to output an error character (a reverse question mark) to the display. 2. The `DEL` control is typically filtered out, but when a 96-character set is designated, it can sometimes be mapped to a printable glyph that needs to be displayed. ## Validation Steps Performed I've manually tested that all the controls that are meant to be filtered out are no longer being displayed. I've also extended the existing `NUL` unit test to cover the full set of controls characters that are supposed to be filtered. Closes #10786
Windows Terminal version (or Windows build number)
Terminal 1.8.1521.0, Windows 10.0.19043.0
Other Software
WSL2, running Manjaro Linux: https://github.com/sileshn/ManjaroWSL
Using Zsh and oh-my-zsh (but reproduced with Bash)
Fira Code Retina font (but run into this with other fonts)
Steps to reproduce
With everything installed properly (
pry
in$PATH
):Expected Behavior
No special characters or control codes should be shown:
Actual Behavior
For some reason, special characters/control codes are being shown:
The text was updated successfully, but these errors were encountered: