Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use with editing disabled ? #241

Open
danielo515 opened this issue Apr 21, 2018 · 5 comments
Open

Can I use with editing disabled ? #241

danielo515 opened this issue Apr 21, 2018 · 5 comments

Comments

@danielo515
Copy link

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
Copy link
Member

@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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

  • Is there any place where I can check the styling options ? I want to get rid of focusability, click, line rule etc.
  • Can I re-write the content of the editor as long as it does not open any file ? Checking the codebase I think there is a method for getting the editor code, but I'm not sure if I can set it.

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

@dbkaplun
Copy link
Member

  • Here are the styling options. These are the defaults which are loaded via dominictarr/rc in the codebase.
  • You can update the contents of the editor by using the methods on editor.textBuf. I think there is an editor.textBuf.setText() which will replace the entire buffer. The widget will automatically watch and render changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants