commit f1835d01199b6e19d713c8ffa002401de9c3201e
parent 66c8973edf1c1afde05d84775148dbf4d6d276b3
Author: William Casarin <jb55@jb55.com>
Date: Tue, 16 Jul 2024 12:43:08 -0700
timelineview: add customizable initial note capacity
We will be using this for threads, so we'll want a smaller
capacity there.
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/timeline.rs b/src/timeline.rs
@@ -70,11 +70,15 @@ pub struct TimelineView {
impl TimelineView {
pub fn new(filter: ViewFilter) -> Self {
+ TimelineView::new_with_capacity(filter, 1000)
+ }
+
+ pub fn new_with_capacity(filter: ViewFilter, cap: usize) -> Self {
let selection = 0i32;
let mut list = VirtualList::new();
list.hide_on_resize(None);
let list = Rc::new(RefCell::new(list));
- let notes: Vec<NoteRef> = Vec::with_capacity(1000);
+ let notes: Vec<NoteRef> = Vec::with_capacity(cap);
TimelineView {
notes,