brownplt / code.pyret.org

Website for serving Pyret to folks.
Other
24 stars 45 forks source link

Adding commenting and searching functionality to CPO #452

Closed jchen closed 2 years ago

jchen commented 2 years ago

Introduction

This adds editor functionality based on brownplt/pyret-codemirror-mode#10 (and depends on this PR). Added are the following keybinds:

Testing

Tested by running locally. Also feel free to bump line 53 of package.json:

 - "pyret-codemirror-mode": "git://github.com/brownplt/pyret-codemirror-mode.git#master",
 + "pyret-codemirror-mode": "git://github.com/jchen/pyret-codemirror-mode.git#master",

to use Codemirror mode changes from brownplt/pyret-codemirror-mode#10 atop CPO to test new functionality.

asolove commented 2 years ago

Oh, this is cool! Please add to the shortcuts dialog as well so they are discoverable.

jchen commented 2 years ago

Added all the shortcut dialogs! I didn't know this help menu was a thing so I did learn something new!

While I was in there, I styled the help dialog a bit - hope that's reasonable:

image
jpolitz commented 2 years ago

OK couple comments now that I've played with this:

I'd like to disable it in REPL entries. These can get focused for lots of reasons and it looks super weird there and completely occludes code in single-line entries

image

Is there a way to get a graphical/clickable close button for it? Many users will not think to press escape while focused on the search box especially if they brought it up by accident by fat-fingering Ctrl-V

jchen commented 2 years ago

@jpolitz These both should be possible - I might need to tinker with it a bit.

I suppose an unintended consequence of importing the script globally was that it applies to all CodeMirror instances which I didn't realize.

Feel free to revert the PR if this blocks other horizon changes from getting merged.

jpolitz commented 2 years ago

Nah I don't think it's worth reverting! It's a good improvement for a lot of people. We should just improve it.