mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 02:37:21 +00:00
Only emit resize event when size changed (#10419)
Currently, terminal will emit resize event every seconds, even if the size not changed. this PR fixed only emit resize event when size is changed. Release Notes: - N/A
This commit is contained in:
parent
f3a78f613a
commit
4e6f24a841
1 changed files with 4 additions and 2 deletions
|
@ -142,7 +142,7 @@ pub fn init(cx: &mut AppContext) {
|
|||
TerminalSettings::register(cx);
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct TerminalSize {
|
||||
pub cell_width: Pixels,
|
||||
pub line_height: Pixels,
|
||||
|
@ -992,8 +992,10 @@ impl Terminal {
|
|||
|
||||
///Resize the terminal and the PTY.
|
||||
pub fn set_size(&mut self, new_size: TerminalSize) {
|
||||
if self.last_content.size != new_size {
|
||||
self.events.push_back(InternalEvent::Resize(new_size))
|
||||
}
|
||||
}
|
||||
|
||||
///Write the Input payload to the tty.
|
||||
fn write_to_pty(&self, input: String) {
|
||||
|
|
Loading…
Reference in a new issue