-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Feature/add ss2 ss3 support #35
base: 1.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bgreenacre Thank you for looking into this and providing this high-quality PR! Adding support for SS2 and especially SS3 makes perfect sense!
I noticed a number of minor things in the PR, can you look into this? Also, perhaps it makes sense to update the stdin-codes.php
example to showcase this?
Again thank you, keep it up!
@@ -75,6 +75,12 @@ are supported as defined in [ISO/IEC 2022](https://en.wikipedia.org/wiki/ISO/IEC | |||
|
|||
* PM (Privacy Message) | |||
|
|||
* SS2 (Single Shift 2) | |||
this means select the following character form the G2 character set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: from
this means select the following character form the G2 character set | ||
|
||
* SS3 (Single Shift 3) | ||
this means select the following character form the G3 character set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: from
@@ -171,6 +175,12 @@ public function handleData($data) | |||
break; | |||
} | |||
} | |||
} else if ($type === 'ss2' || $type === 'ss3') { | |||
$data = substr($this->buffer, 0, 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic looks about right! 👍 This needs an additional check to ensure that 3 bytes are available in the buffer and set $found
accordingly (also needs additional tests).
I couldn't get this lib to emit my f1 to f4 keys properly. Or rather they were get emitted as c1 with the last character chopped off. Did some research and found out about ss2 and ss3 control codes. So I added a check for the two types in
ControlCodeParser
for strings starting with^[N
(ss2) and^[O
(ss3) and to emit them asss2
andss3
respectively with that extra character.For reference https://en.wikipedia.org/wiki/ANSI_escape_code#Fe_Escape_sequences