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

Fix alt modifier #441

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mikelorant
Copy link
Contributor

The alt modifier was not handled correctly for both sending and recording key presses.

To send the key press, the ESC sequences needs to be transmitted before the key.

For recording, the escape sequences lookup table had to be updated with all alphanumeric combinations.

Syntax highlights had also not been updated.

@mikelorant
Copy link
Contributor Author

@maaslalani Can you review this. Thanks.

@maaslalani
Copy link
Contributor

Thanks so much @mikelorant! ❤️

@maaslalani
Copy link
Contributor

Does this work for you? It doesn't seem to work correctly for me on MacOS. This is pressing Alt+Left and Alt+Right.

image

@mikelorant
Copy link
Contributor Author

I'm wondering if this comes down to what alt means?

escplus

My own tests were from macOS. Can you install showkey and see what you get?

@mikelorant
Copy link
Contributor Author

@maaslalani Please see issue #442 for the details. I believe you do not have your terminal set correctly and are not actually sending what is considered the alt key.

@mikelorant
Copy link
Contributor Author

Further testing has made things a bit more confusing.

WezTerm

alt + b = <ESC>b
alt + = <ESC>[1;3D

macOS Terminal

alt + b = <ESC>b
alt + = <ESC>b

@mikelorant
Copy link
Contributor Author

May have a solution for you, will test this out tomorrow and update the pull request.

  • For 0 to 9 and a to z send ESC + character.
  • Everything else, hold down alt and send the key press (method currently used for enter and tab).

In terms of recording, need to do some brainstorming. Only have the tables to lookup against. May need to add all the key presses we can think of.

What terminal are you using?

The alt modifier was not handled correctly for both sending and
recording key presses.

To send the key press, the `ESC` sequences needs to be transmitted
before the key.

For recording, the escape sequences lookup table had to be updated with
all alphanumeric combinations.

Syntax highlights had also not been updated.

Signed-off-by: Michael Lorant <[email protected]>
@maaslalani
Copy link
Contributor

Yeah you're most likely right about my alt key actually being meta, since I'm on a Mac.
I can try again with turning the Alt key as Meta off.

@mikelorant
Copy link
Contributor Author

Want me to fix up the conflicts and then you can experiment with this branch?

@bashbunni
Copy link
Member

Hey, sorry for the delay on this. How should this be used? I tried adding Alt+1 to an example and got an error:

File: examples/welcome.tape
Host your GIF on vhs.charm.sh: vhs publish <file>.gif
 26 │ Alt+1
         ^ Expected alt character, got +

 26 │ Alt+1
          ^ Invalid command: 1

parser: 2 error(s)
recording failed
exit status 1

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.

3 participants