Comments (2)
Yes, absolutely
The ScrollablePane from PT works by rendering all child elements to a virtual screen, then copying only the visible interest to the display. This is not good for performance, especially with a large number of child elements, because every child is redrawn on every refresh.
My ScrollingContainer implementation accepts a list of functions which return child elements, so they can be created on the fly. Instances of child elements are only created for those elements which are currently in view, and only visible children are rendered. When a child is no longer visible, all references to it's instance are dropped, meaning it will be cleaned up by the GC.
Children which are partially visible are drawn by rendering them on a virtual screen, then copying only the visible lines to the display.
The effect of scrolling as achieved by maintaining a reference to the current (selected) child, and it's offset from the top of the available space. Scrolling up or down if done by adjusting this offset. When drawing to the screen, the selected child is drawn first, then the space above and below are then filled with neighbouring children until the available space is full. The child heights are cached to prevent having to render a large number of children just for their heights if the selected child is scrolled a long way off screen.
There are a few things I'm planning to contribute upstream from euporie:
-
ScrollingContainer - this will need a bit more work to make it more generic, as I built it with the specific use case in mind and I'm not sure how it will work with different types of PT widgets as children
-
I also implemented clickable scrollbars on the ScrollingContainer (prompt-toolkit/python-prompt-toolkit#773)
-
I also built on PT's ANSI formatted text parser to allow the conversion of ANSI escape sequences to ZeroWidthEscape sequences. I want to try a different approach to this using regex, which I think might be simpler.
-
I implemented markdown table rendering in rich using a modified version of CommonMark-py-Extensions (Textualize/rich#3)
from euporie.
Thanks for the detailed explanation, this looks great! In nbterm I'm using ScrollablePane
and I noticed it doesn't scale well, so I'm really interested in your ScrollingContainer
. All these upstream contributions would be really awesome.
from euporie.
Related Issues (20)
- Key bindings in tmux HOT 3
- How to connect to hub HOT 12
- Xonsh support HOT 16
- Mac support HOT 2
- Confused about emacs keybindings HOT 5
- Plots are truncated HOT 10
- [Feature Request] Load percent python scripts as Notebook HOT 3
- ValueError: Unable to configure handler 'log_tab' HOT 2
- Bug: KeyError: 'log_file' HOT 2
- Using chafa.py gives (Format Conversion Error) HOT 7
- render error on matplotlib plots HOT 2
- How to connect notebook to kernel HOT 2
- Does this project support editing in $EDITOR? HOT 2
- Kernel died before replying to kernel_info HOT 8
- Inconsistency of `typing-extensions` and `platformdirs` in the dependencies HOT 2
- euporie-console stuck (unresponsive) for a long time on simple plots HOT 5
- Euporie Notebook freezes when typing `df[`
- Euporie Notebook freezes when typing `df[` HOT 5
- installing missing binaries HOT 2
- Improve the speed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from euporie.