ci_edit icon indicating copy to clipboard operation
ci_edit copied to clipboard

Support of "cmd" key for osx

Open yevhen-hryhorevskyi opened this issue 7 years ago • 1 comments

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?

yevhen-hryhorevskyi avatar Nov 08 '18 17:11 yevhen-hryhorevskyi

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

dschuyler avatar Nov 15 '18 03:11 dschuyler