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

Initial buffer #64

Closed
cmdln opened this issue Aug 21, 2017 · 5 comments
Closed

Initial buffer #64

cmdln opened this issue Aug 21, 2017 · 5 comments

Comments

@cmdln
Copy link
Contributor

cmdln commented Aug 21, 2017

I have a cli I am writing that saves some data to file based on an initial run. Re-running loads that file, it would be nice to present the saved values for editing. Other than re-implementing some internal functions of Context, I cannot see a way to do this really. If I could pass my own buffer into an additional read_line method, that would very nicely do it. I'll see if I can come up with a quick PR that demonstrates what I mean.

@MovingtoMars
Copy link
Owner

How about adding EventKind::EditorInit which is sent when a new editor is created? And when you receive that event, you can insert the text you want.

@iamcodemaker
Copy link
Contributor

Is that better than adding a new constructor? Seems less discoverable.

@cmdln
Copy link
Contributor Author

cmdln commented Aug 22, 2017

The event idea works for me. I initially started down that path but then realized the user experience was pretty crummy that the buffer only get updated if the user hit a kit.

@MovingtoMars
Copy link
Owner

I've added Context::read_line_with_init_buffer() and Editor::new_with_init_buffer() in 5862d60.

I think I need to look into changing how events work slightly before that option is good.

@cmdln
Copy link
Contributor Author

cmdln commented Aug 25, 2017

Thank you!

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

3 participants