Revert terminal memory leak fixes (#23636)

New mechanism had introduced the following regressions:

* Windows tasks are not registering child exit properly, sometimes
getting stuck in dirty state (even with
https://github.com/zed-industries/zed/pull/23631):


https://github.com/user-attachments/assets/6d406f17-aa76-4012-9c3b-be72d6d5beae

* Overall, the terminal editing started to feel more sluggish, esp. in
regards to deletions (ctrl-w and backspace), tested on macOS:


https://github.com/user-attachments/assets/3a69fe2e-e394-45e8-8f51-0f5ac396cb24


Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2025-01-25 06:35:24 +02:00 committed by GitHub
parent b7c6ffa6c2
commit f5102838f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 68 additions and 136 deletions

View file

@ -16,7 +16,6 @@
//!
use alacritty_terminal::{
event::VoidListener,
grid::Dimensions as _,
index::{Column, Line, Point},
term::Config,
@ -25,6 +24,8 @@ use alacritty_terminal::{
use gpui::{canvas, size, ClipboardItem, FontStyle, Model, TextStyle, WhiteSpace};
use language::Buffer;
use settings::Settings as _;
use std::mem;
use terminal::ZedListener;
use terminal_view::terminal_element::TerminalElement;
use theme::ThemeSettings;
use ui::{prelude::*, IntoElement};
@ -49,7 +50,7 @@ pub struct TerminalOutput {
/// ANSI escape sequence processor for parsing input text.
parser: Processor,
/// Alacritty terminal instance that manages the terminal state and content.
handler: alacritty_terminal::Term<VoidListener>,
handler: alacritty_terminal::Term<ZedListener>,
}
const DEFAULT_NUM_LINES: usize = 32;
@ -123,9 +124,14 @@ impl TerminalOutput {
/// and sets up the necessary components for handling terminal events and rendering.
///
pub fn new(cx: &mut WindowContext) -> Self {
let term =
alacritty_terminal::Term::new(Config::default(), &terminal_size(cx), VoidListener);
let (events_tx, events_rx) = futures::channel::mpsc::unbounded();
let term = alacritty_terminal::Term::new(
Config::default(),
&terminal_size(cx),
terminal::ZedListener(events_tx.clone()),
);
mem::forget(events_rx);
Self {
parser: Processor::new(),
handler: term,