aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/compositor.rs
diff options
context:
space:
mode:
authorPascal Kuthe2023-09-01 00:13:36 +0000
committerGitHub2023-09-01 00:13:36 +0000
commita38ec6d6ca9e5dbbd2e313f3173f2e967ed71fc1 (patch)
treec82634fcff102a8252d17a4af80de9cde203f37b /helix-term/src/compositor.rs
parent7cf775d5128e701722290ef29945549c96e79bd1 (diff)
avoid excessive memory consumption in picker (#8127)
* avoid excessive memory consumption from file picker * fix typos Co-authored-by: Chris <75008413+cd-a@users.noreply.github.com> --------- Co-authored-by: Chris <75008413+cd-a@users.noreply.github.com>
Diffstat (limited to 'helix-term/src/compositor.rs')
-rw-r--r--helix-term/src/compositor.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs
index bcb3e449..dc962e1f 100644
--- a/helix-term/src/compositor.rs
+++ b/helix-term/src/compositor.rs
@@ -16,6 +16,7 @@ pub enum EventResult {
}
use crate::job::Jobs;
+use crate::ui::picker;
use helix_view::Editor;
pub use helix_view::input::Event;
@@ -100,6 +101,11 @@ impl Compositor {
/// Add a layer to be rendered in front of all existing layers.
pub fn push(&mut self, mut layer: Box<dyn Component>) {
+ // immediately clear last_picker field to avoid excessive memory
+ // consumption for picker with many items
+ if layer.id() == Some(picker::ID) {
+ self.last_picker = None;
+ }
let size = self.size();
// trigger required_size on init
layer.required_size((size.width, size.height));