From 396002cc0e650055e3535e7a88463650bb5ee8ee Mon Sep 17 00:00:00 2001 From: Ayose Date: Sun, 16 Oct 2022 23:22:33 +0100 Subject: Set graphics limit per cell. The limit per grid is increased to `1000`, and a new limit per cell is added, set to `20`. --- alacritty/src/renderer/graphics/mod.rs | 2 +- alacritty_terminal/src/term/mod.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/alacritty/src/renderer/graphics/mod.rs b/alacritty/src/renderer/graphics/mod.rs index 9a22e871..a6b601b2 100644 --- a/alacritty/src/renderer/graphics/mod.rs +++ b/alacritty/src/renderer/graphics/mod.rs @@ -23,7 +23,7 @@ mod draw; mod shader; /// Max. number of textures stored in the GPU. -const MAX_TEXTURES_COUNT: usize = 100; +const MAX_TEXTURES_COUNT: usize = 1000; pub use draw::RenderList; diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index d54d9998..a35fade2 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -44,6 +44,9 @@ const TITLE_STACK_MAX_DEPTH: usize = 4096; /// Default tab interval, corresponding to terminfo `it` value. const INITIAL_TABSTOPS: usize = 8; +/// Max. number of graphics stored in a single cell. +const MAX_GRAPHICS_PER_CELL: usize = 20; + bitflags! { pub struct TermMode: u32 { const NONE = 0; @@ -2159,6 +2162,11 @@ impl Handler for Term { cell_height as usize, ) => { + // Ensure that we don't exceed the graphics limit per cell. + while old_graphics.len() >= MAX_GRAPHICS_PER_CELL { + drop(old_graphics.remove(0)); + } + old_graphics.push(graphic_cell); old_graphics }, -- cgit