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

Support of "cmd" key for osx #176

Open
yevhen-hryhorevskyi opened this issue Nov 8, 2018 · 1 comment
Open

Support of "cmd" key for osx #176

yevhen-hryhorevskyi opened this issue Nov 8, 2018 · 1 comment

Comments

@yevhen-hryhorevskyi
Copy link

Hi there.
I found your text editor awesome and greatly like it. Thanks for a great job!!

But I have a dummy question if there is an ability to add also a "cmd" support instead of "ctrl" for osx users?

@dschuyler
Copy link
Collaborator

Thanks!

I use a MacBook and I have the cmd key on the caps-lock and ctrl on the cmd key :). I think there's a lot of folks who like to make the caps-lock a ctrl key. I realize this isn't a general solution, just trivia really.

I'm up for making cmd work if it's practical.

It's a bit tricky because the terminal (I'm using iterm2 for example) captures a lot of the cmd key sequences. So ci_edit doesn't normally get to see them. There may be some configuration setting to pass the cmd key to ci_edit (likely as the Meta key). If the terminal did pass along the cmd key presses then keys like cmd+w to close the terminal window, or cmd+t to create a new tab might stop working (i.e. we might need to choose if the terminal window uses those keys or if ci_edit uses them).

If you'd like to help (this is rather technical, if you're not up for it that's no trouble):

ci_edit can accept a --log argument on the command line. This will split the display into four quadrants.

  • The upper left is the normal ci_edit window(s)
  • The lower left is a scrolling log of events
  • The lower right shows some of the undo/redo state
  • The upper right show debug information
    It's that last one we'll be looking at. In that section there is a line that starts with ch. It might say something like ch 258 KEY_DOWN if you press the cursor down arrow. This is reporting every key that ci_edit sees, as it sees them.

When I press cmd+L the ch line doesn't change. This is because the terminal isn't even passing that event to ci_edit. There might be some way to make your terminal pass along the cmd+L (or any other cmd keys). If you're able to find it, that ch line should change.

If we can get the events, i.e. if we can see that cmd+L or cmd+s (and so on) are being pressed, then we (or I) can make ci_edit react to those keys (events).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants