ldct / isicp

Interactive Structure and Interpretation of Computer Programs
http://www.xuanji.li/isicp/
MIT License
1.16k stars 162 forks source link

Allow Cmd-Enter evaluation for Mac users #43

Closed lambdahands closed 9 years ago

lambdahands commented 10 years ago

Hey, I'm really digging this project. I noticed I have to run Ctrl-Enter to evaluate code; however, a common convention is to allow Mac users to use Cmd-Enter as well.

I noticed your'e using CodeMirror, and from a previous previous commit that solves #11, you could do something like this:

editor.setOption('extraKeys', {'Cmd-Enter': function() {
  editor.getOption("onBlur")();
}});

Thoughts?

ldct commented 10 years ago

I don't think Mac users should be allowed to use isicp.

Just kidding, this is a great idea. Would you mind submitting a PR?

lambdahands commented 10 years ago

Haha, you totally had me for a second.

I dug up the past commit, but I noticed the file I need to pull is under a directory in .gitignore.

Edit: Accidentally closed/reopened.

ldct commented 10 years ago

@lambdahands we factored out the part of the code that does evaluation etc, you should be able to find the file at https://github.com/yuanchenyang/coding-js/

ldct commented 9 years ago

Fixed in yuanchenyang/coding-js@b20a53c7bb967d42a73fef6393416bb7f317cc2d