Closed ryanlaws closed 4 years ago
Awesome - will get this tested and merged (hopefully tomorrow)
Thank you! I updated my comment above for readability by the way - it was sourced from the commit body and looked pretty bad in markdown.
@ryanlaws: this is awesome! a few questions...
is there any reason to do this only for CTRL+P
? are the other commands ok because there aren't problematic collisions?
the idea of the commandService
was to consolidate service handling; is there any way this could be integrated more tightly there? (or was that just an odd way to go about encapsulating handlers?)
cheers!
Huh, I must have been making that cleanup commit at the same time you were commenting.
are the other commands ok because there aren't problematic collisions?
Exactly. I've actually only tested CTRL+S and CTRL+P.
the idea of the
commandService
was to consolidate service handling
Ahh, I like this. The single command hanging out in the JSX felt dirty. It would be a lot cleaner and better for maintenance to create an adapter from the keyService.bindings
that plugs into the commands
prop in editor.js
.
Alrighty, I think that's an improvement!
I tested CTRL+B, CTRL+E, CTRL+P, and CTRL+S; those are all working for me. CTRL+; doesn't work and throws an exception but I think that already existed.
💎 💎 💎
Looks awesome!
If someone would like to test this with OSX that'd probably be good at least as a smoke test. If no one has an OSX machine at hand, I can set it up and test. More eyeballs are definitely better, though.
I hope to have time this evening to test and merge. It’s been a busier week than I anticipated.
No worries - thank you!
Thank you!
This fixes
CTRL+P
in the editor for "playing" the current script (fix #71). I tested it for the default Ace keybindings and for the Vim ones. The existing keybindings applied to the window, but were overridden by the Ace editor and it appears that their default/lower-precedence behaviors were prevented.The significant change is twofold. First, the relevant
activeBuffer
andscriptRun()
props are passed fromEditActivity
to itsEditor
. The former had to be aliased toactivityActiveBuffer
due to conflicts surfaced in testing. This is then wrapped in agetActiveBuffer()
helper inrender()
to ensure freshness. Next, acommands
prop is passed to saidEditor
, which is an array of commands associated with keys. The sole member ofcommands
is a mapping ofCTRL+P
to a call toscriptRun
with the active buffer.Next, for Vim, the
<C-p>
mapping found in the defaults is just removed. The Vim keybindings take priority in Ace, and removing that binding from Vim forces it to fall back to the main binding list, which includes the aforementionedCTRL+P
mapping.