Comments (10)
While thinking about this I went ahead and made a small improvement to the list API in d7bf9e1 which moved the list element drawing function from being in the list state itself to being a parameter to renderList
, thus further separating the presentation and state concerns.
from brick.
I also changed lists to use Vector e
instead of [e]
in 14d2147 since many vector operations are O(1) while their list counterparts are O(n).
from brick.
I've pushed a commit (693abbb) to address this. The only user-facing change is that renderList
now takes an item height (in rows) and all item widgets returned by the item drawing function must match that height (or else). It's in the feature/long-lists
branch. Give that a try.
from brick.
FYI: I tested this solution with lists of 100,000 elements and saw no discernible performance difference between those and lists with ten elements. The reason is because the vector slice operation that obtains the sub-list is O(1).
from brick.
Thank you! Sounds great. (Of course, my items are variable height; this will be strong incentive to change that).
from brick.
Is that something your application needs? There might be other strategies, since you could always implement a custom widget and sidestep the List entirely. It would just be more work. :) But knowing that your elements all have the same height might have other benefits; I don't know.
from brick.
Currently when Ledger (and hledger's) register report contains multi-currency balances, each currency is shown on its own line.
In hledger's multicolumn balance reports, because this disrupted the tabular layout I changed this to show such balances on one line, comma separated. I plan do the same thing here.
from brick.
I confirm your latest List renders without the slowdown here too.
However I think str is no longer right-padding to the full terminal width. Eg with a box enclosing the list, each | of the box's right border is rendered immediately following the list element instead of at the terminal edge.
from brick.
If you can reproduce using a minimal demo program and file an issue, I would be happy to take a look!
from brick.
I'm going to mull over the change for this ticket and decide wether to merge to master; I need to decide whether giving up mixed-height list items is problematic.
from brick.
Related Issues (20)
- Is it possible to implement a scrollable spreadsheet with brick? HOT 1
- Horizontally scrollable tabular list widget HOT 42
- Type parameters of the "n" thingy HOT 12
- Requesting discussion group in github or somewhere else. HOT 3
- I can't zoom without template haskell. HOT 5
- I think I discovered a broken link in the docs HOT 1
- Some Alt keyboard shortcuts trigger escape key. HOT 10
- Does renderBox need to crop its contents to the context? HOT 1
- Optics support HOT 5
- renderBox crops the contents to the context width minus one. HOT 4
- Constructing an Editor widget from [(String, String)] HOT 17
- Pressing option minus on Mac before app runs causes sigsegv HOT 5
- Windows support HOT 7
- Question: entering text from user HOT 6
- [WIP] How to unit test Brick apps HOT 3
- I think I found a typo HOT 1
- How to debug Brick applications HOT 4
- ld: library not found for -liconv clang-13: error: linker command failed with exit code 1 (use -v to see invocation) `clang' failed in phase `Linker'. (Exit code: 1 HOT 1
- Wrap repeating code in a function HOT 18
- handleFormEvent doesn't update form field validation state? HOT 22
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 brick.