-
Notifications
You must be signed in to change notification settings - Fork 732
Can I make long forms or nested layouts that are scrollable? #1065
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
Comments
Hi @andy0130tw, This is indeed a feature request that's been asked a couple of times before, and I haven't come around implementing it. At the moment it is not possible. It should be doable, but not really easy either. If I have some time, I'll try to write down the steps to implement it. I'm not entirely sure, but maybe it is possible to implement with Urwid. |
@jonathanslenders Thanks for the quick response! I am new to TUI applications, and feel this toolkit is really handy from simple prompts to full-featured text editors. I really appreciate it. Comparing from Urwid, my understanding is the design goal, and therefore, the strategy, is different. Urwid's manual deals with layouts a lot but lacks of default behaviors that glues the components together. Anyway, I really look forward to this feature gets implemented in this toolkit. |
@andy0130tw Did you manage to get this working, or do you have any further tips on how to achieve it? |
Actually, this was implemented some time ago, using See these examples: https://github.com/prompt-toolkit/python-prompt-toolkit/tree/master/examples/full-screen/scrollable-panes Hope that works! |
Wow, thanks. I have not actively used this package since then. Glad to see this feature implemented in this powerful toolkit! |
When building applications that prompt rich forms, we may need the capability that we could scroll some long contents, optionally with viewport following the cursor. An example that implements this concept is
nmtui
.If a widget is simple, one approach is to (ab)use
FormattedTextControl
inside a window, typesetting (?) the content of each block and arrange cursor positions. This idea works well with smaller components, and is already seen in widgets likeCheckboxList
, #711 for editable buffers, and the option list of pyvim (this is especially brilliant, in my oponion).When building some complex blocks to compose them, the logic to maintain contents/positions for a long block would be a nightmare. For an instance of what I mean complex, see cslack, in urwid.
It is straightforward to mock a view using
HSplit
andVSplit
, however they seem to divide the screen and cannot be placed inside a window. I have seen a similar feature request in #949 and surveyed some showcases, but still have no idea on how to achieve this. Maybe I should start by inheriting UIContent. Is there some development docs that I can refer to create such a component?The text was updated successfully, but these errors were encountered: