Skip to content

Attaching a history to a full screen application widget #614

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

Open
meeas opened this issue Apr 24, 2018 · 2 comments
Open

Attaching a history to a full screen application widget #614

meeas opened this issue Apr 24, 2018 · 2 comments

Comments

@meeas
Copy link

meeas commented Apr 24, 2018

I think I'm missing something simple here. I haven't been able to figure out how to attach a history to a Buffer in the full screen application. I'm using a TextArea widget for the input, and it doesn't seem to support passing of a history to it, which BTW would be a wonderful feature request. I've also tried to create my own widget based on the TextArea class where I've added a history to the included Buffer, which seems to instantiate without issue, but not to activate the history. Perhaps in a full screen application I also have to add a Key.Up binding to it somehow as well?

If you are interested, my base code is at https://github.com/ControlThingsTools/ctserial

And as a second related feature request, I think it would help a lot of people to have this solution added to the examples/full-screen/calculator.py example. In fact, since you are more familiar with the calculator code, even a brief explanation of how to add history to it would help me address my own issue.

BTW, thank you very much for all the wonder examples in 2.0. I struggled in using 1.x full-screen applications and eventually settled with just using basic prompt features, but all your examples for full-screen apps in 2.0 has me migrating all of my apps from basic prompt feature to full screen features.

@jonathanslenders
Copy link
Member

In order to make the history work with a Buffer, the Buffer needs an accept_handler. That way, the enter key binding will call buffer.validate_and_handle() and add the entry to the history.

The TextArea does indeed not have a history argument yet. I will consider adding it, but that's at least for after the release of 2.0 to Pypi.

Thanks for the feature requests. It's always good to get feedback. :-)

@decentral1se
Copy link
Contributor

Also kinda related to #652.

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

No branches or pull requests

3 participants