slap-editor / editor-widget

Editor widget used by slap-editor/slap
MIT License
23 stars 14 forks source link

Can I use with editing disabled ? #241

Open danielo515 opened 6 years ago

danielo515 commented 6 years ago

Hello,

Thanks for this gread widget. I want to use it without editing capabilities, this means just syntax highlight and scrolling. I want to control the text content programmatically. I'll be adding content to a file, I don't know if hot reload of a file is supported or If I have to feed editor-widget myself.

Thanks in advance.

dbkaplun commented 6 years ago

@danielo515,

You can disable editing by calling editor.readOnly(true) on an editor instance.

Regarding hot reloading, editor-widget will hot reload an open file, assuming text-buffer supports this feature, which may not be the case.

Hope that helps!

danielo515 commented 6 years ago

Hello @dbkaplun , thanks for your prompt response. Exactly what I needed. Thank you very much. Assuming it is not able to hot-reload a file, how could I add new content to the editor window ? Just append it at the end I mean.

Regards

danielo515 commented 6 years ago

I just tried and on my computer the file is hot reloaded, very cool. I think it works as long as the file descriptor opened and then closed.

Now I have to figure out how to accept text input on blessed, which is getting tricky

danielo515 commented 6 years ago

Stupid me, I can just use your editor for both tasks. However, I have a couple of doubts about it:

Many thanks for your support, and of course for this awesome tool

dbkaplun commented 6 years ago