Skip to content
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

Open
wants to merge 3 commits into
base: 1.x
Choose a base branch
from

Conversation

bgreenacre
Copy link

@bgreenacre bgreenacre commented Nov 12, 2021

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 as ss2 and ss3 respectively with that extra character.
For reference https://en.wikipedia.org/wiki/ANSI_escape_code#Fe_Escape_sequences

Copy link
Owner

@clue clue left a 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
Copy link
Owner

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
Copy link
Owner

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);
Copy link
Owner

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

@clue clue added this to the v1.4.0 milestone Dec 20, 2021
@SimonFrings SimonFrings modified the milestones: v1.4.0, v1.5.0 Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants