cronvel / terminal-kit

Terminal utilities for node.js
MIT License
3.08k stars 198 forks source link

[ REQUEST ] more events akin to JS events #219

Open octoshrimpy opened 1 year ago

octoshrimpy commented 1 year ago

usecase: modeless term editor w/ optional mouse input

source: https://github.com/octoshrimpy/brain-cli/blob/master/null

It would be nice to have more events on form input elements, similar to the js events currently present in the browser. As it stands, the code can differentiate between focus and blurred to set appropriate styling. I'd love to listen to the onBlur event to enable/disable the cursor for when the user clicks outside the textbox.

cronvel commented 1 year ago

@octoshrimpy Hmm, I think the blur event already exists for most (if not all) the widget. It's part of the Element base class, so all widget got it.

If you are building you own text editor, you may want to have a look into ne (aka Neon), the editor I'm developing. Be sure to install it from npm OR to check out a release tag because the last time I worked on it, I left it in an unclean state. It supports Javascript syntax hilighting, and it's a rather good demo of what Terminal Kit can do. The hilighting code is not yet optimized, so it can be a bit slow on 2000+ files.